The Google Geofencing app for example only works if another app is open using GPS

I am working with the Geofence API Sample application. It works for me and seems to work fine. I made modifications to use BroadcastReceiver instead of IntentService.

But I receive notifications only if I have another application open using GPS, such as Maps or the GPS Tester application.

If I do not have one of these applications, and I go into the geofence zone, nothing happens. But as soon as I launched one of them, I will receive a notification in a few seconds.

+6
source share
2 answers

As a result, I created a service that makes GPS stay active, requesting location updates in a relatively short amount of time.

Although this is admittedly not working well for a "real" application. It worked for my purposes. In which I was supposed to be able to provide working proof of the concept of the audience, which hampered my ability to use geographical points, which were even more common.

+2
source

Even I, too, dealt with receiving a Geofence notification as soon as I entered or exited Geofence. There were always delays in notifications until I found a really beautiful location library called little-fluffy-location-library that serves my purpose. Periodic updates will be periodically transmitted to your application.

According to the Documentation, he says that:

The library works using the Froyo passive location receiver (only possible with Android 2.2 and higher, so it works best with it), which listens for location updates requested by other applications on your phone. The most accurate location is broadcast to your application approximately every 15 minutes. If the location update is not received from another application within an hour, the library forces it to update the location.

I think you should try this library and let me know if it works for you!

+2
source

Source: https://habr.com/ru/post/972517/


All Articles