GeofencePlugin
GeofencePlugin copied to clipboard
Would CrossGeofenceListener (IGeofenceListener) callbacks work on iOS if app is killed
I am using this plugin for Android and it working well except for the System.InvalidCastException: Specified cast is not valid. bug which someone provided the workaround for. My question is for iOS. If app is killed and a georegion is entered/exited would CrossGeofenceListener callbacks still be called?
Yes, they do. In iOS, the geofencing API uses StartMonitoringSignificantLocationChanges which relaunches the app into the background if a new event arrives, IE a geofence event occurs. This is when the app is killed from memory too. You can read this. In Android, the provided service runs the geofencing triggers when the app is closed as well. In my testing, android 8 and above you have to use StartForgroundService instead of StartService, or else you'll get an exception due to google limiting starting services in the background.