CrossGeeks / GeofencePlugin

Geofence Plugin for Xamarin iOS and Android
MIT License
48 stars 22 forks source link

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

Open coosmiyn opened 5 years ago

coosmiyn commented 5 years ago

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 commented 5 years ago

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.

nguyenthanhliemfc commented 5 years ago

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

coosmiyn commented 5 years ago

@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.

carloscacua commented 5 years ago

@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.

nguyenthanhliemfc commented 5 years ago

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

striboldt commented 4 years ago

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.