GeofencePlugin icon indicating copy to clipboard operation
GeofencePlugin copied to clipboard

Geofence not working while the app is closed on different Android OS'

Open coosmiyn opened this issue 5 years ago • 6 comments

I am using this NuGet on Android 7, 8 and 9 and if I close the app the geofence doesn't work anymore. It works while the app is open or while in foreground but if I close it, nothing works anymore. I implemented everything needed (at least that's what I think), especially the GeofenceService and AppStarter in my Android project (I am using Forms) but still it doesn't work.

coosmiyn avatar Apr 17 '19 14:04 coosmiyn

Update: Think everything works besides the CrossGeofenceListener which cannot be executing code while the app is closed. Tried making it a service in different ways, but still haven't got anywhere with it. Will be trying some more and update this if I get somewhere.

coosmiyn avatar Apr 24 '19 13:04 coosmiyn

I have the same problem with you, Is it work when minimzize?

nguyenthanhliemfc avatar Apr 26 '19 01:04 nguyenthanhliemfc

@nguyenthanhliemfc Yes, it does. I took a deeper look in the plugin files and at least it should display a notification when I enter or exit a geofence with the app closed, if it doesn't execute the CrossGeofenceListener code, but it doesn't do a thing. I also tried with release version and still nothing. I am not sure what to try, I tried different things.

coosmiyn avatar May 06 '19 13:05 coosmiyn

@coosmiyn @nguyenthanhliemfc Hey guys I was having the same issue and doublechecking I was missing some of this permission on manifest: android.permission.ACCESS_FINE_LOCATION android.permission.ACCESS_COARSE_LOCATION com.google.android.providers.gsf.permission.READ_GSERVICES android.permission.RECEIVE_BOOT_COMPLETED. This permission allows the plugin to restore any geofence region previously monitored marked as persistent when rebooting.

carloscacua avatar May 22 '19 21:05 carloscacua

I only see Write Gserveice not have Read Gservice???

nguyenthanhliemfc avatar May 24 '19 04:05 nguyenthanhliemfc

Could it be related to GeofencePlugin is using an IntentService (which on Android O API level 28 and later) will apply background execution limits. Seems that the GeofencePlugin should be using a JobIntentService instead.

striboldt avatar Jul 31 '19 11:07 striboldt