I have implemented the geoFence api and everything is working good. But there are some problems, I want more clarification regarding my confusions.
Here are some of the confusions and problems:
I want my user to get notified when he enters a geofenced area. I have implemented the GeofenceTransitionsIntentService as per guideline but it is not triggering the transition when the app is in background. What should I need to do?
GeoFence Expire time: it is pretty obvious that if we enter Never it is not going to expire, but I am confused about the time. For example if I set it to 10 minutes, what does that exactly do? Will the geofence expire after the given time since it is created or it would expire when the user arrives at that place and then the timer would start? How can we get the geofence to expire when the user gets there.
How is Google tracking us? How does the geofence actually work? We are not sending our location, then now it is tracking ? Does it start tracking us when we add a geofence and then notify us when arrived at that place?
Please tell me and discuss about these confusions, especially my confusion about it working while the app is closed or destroyed.
About 1.) According to this Google I/O Talk When you're using PendingIntents the Location API should wake up your app even if it's runnning in the background, although from my experience the Geofencing events are quite unreliable, but this might be related to a bad GPS receiver in the device I used for testing.
来源:https://stackoverflow.com/questions/37565321/geofence-device-when-app-is-in-background