Search code examples
androidgpslocationandroid-geofence

Android Geofencing sample app only works if another app is open using GPS


I am working with the Geofence API Sample application I've got it running and seems to work alright. I did make the modifications to it to use BroadcastReceiver instead of the IntentService.

But I will only get the notifications if I have some other app open that is using GPS such as Maps, or GPS Tester app.

If I don't have one of those apps open and I walk into the geofence zone nothing happens. But as soon as I launch one of them I will get the notification within a few seconds.


Solution

  • I ended up creating a service that forces the GPS to stay active by requesting location updates on a relatively quick interval.

    While this is admittedly a poor work around for a "real" application. It worked for my purposes. In which I needed to be able to present a working proof of concept to an audience, which impeded my ability to use a geo points which were further spread out.