Xamarin forms app, running on iOS and Android, using Geofence Plugin.
I have implemented a CrossGeofenceListener, which basically gives the user a notification when he is entering/leaving an area. What I would like to do, is to interact with the app (a ViewModel) to behave more intelligently. A simplified example:
The app allows the user to be checked in to certain locations, one at a time.
1.When entering a location and not already checked in: Notify
2.When entering a location and already checked in: Do nothing
3.When leaving a location while checked in: Notify
4.When leaving a location and not checked in: Do nothing
This would require some sort of shared state, either by injecting my viewmodel or some other object to the CrossGeofenceListener, or some other strategy. Since the app itself is likely to be backgrounded when entering/leaving a location, I wonder if this is even possible, and if so, what are the best practices around it. I guess there can be differences between Android/iOS as well, since Android is implementing a separate backgrounding service, while iOS seems to be able to handle it by itself.
Would I be able to inject the whole ViewModel to the CrossGeoFenceListener and read/manipulate values just as I want?
The next step is of course to actually try it out, but wanted to ask first in case any of you guys already know, since it is a big hassle to test these things, since it basically requires me to walk in and out of the defined area.