Open dkarzon opened 7 years ago
On app close you need to specifically remove all the geofences, else android will keep on monitoring the fences and pass on the events to GeofenceTransitionsIntentService.
@Shan11812 In this case I want Android to continue to monitor the Geofences after the app is closed. As a work around I have implemented my own GeofenceTransitionsIntentService
where I init the service if required and fire off the appropriate code I need to.
We addressed this by adding waits to the geofence handlers that only go through after the geofence plugin is initialized, we track initialization in our geofence handling class using a boolean that is set once OnAppInitialized is called.
We submitted a couple pull requests that address this and the authors of this package released a new plugin that incorporate them. Try https://www.nuget.org/packages/Plugin.Geofence/, it is almost a complete drop in replacement with the exception of a namespace change and can be used in projects targeting API 27.
On Android when running the app and setting up monitoring. If you close the app while still monitoring and trigger one of the transitions (enter, stay, exit, etc.) Android will attempt to call GeofenceTransitionsIntentService but the service will fail with an exception
CrossGeofence - Plugin is not initialized. Should initialize before use with CrossGeofence Initialize method. Example: CrossGeofence.Initialize<CrossGeofenceListener>()