Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 449
FoamyGuy Avatar asked Jul 20 '14 00:07

FoamyGuy


People also ask

How does geofencing work android?

Geofencing combines awareness of the user's current location with awareness of the user's proximity to locations that may be of interest. To mark a location of interest, you specify its latitude and longitude. To adjust the proximity for the location, you add a radius.

How does Google geofencing work?

The geofencing API allows you to define perimeters, also referred to as geofences, which surround the areas of interest. Your app gets a notification when the device crosses a geofence, which allows you to provide a useful experience when users are in the vicinity.

Can you geofence on Google Maps?

Geofencing through Google Maps ads also allows you to identify where, exactly, a business' ads will appear. Companies can then track which customers enter their business and make a purchase as a result of viewing their ad.

What is the recommended radius for a geofence?

To ensure the geofence precision, it is recommended that the geofence radius be at least 200 meters. Precision cannot be assured if the geofence radius is less than 200 meters. A maximum of 100 geofences can be added for each app on a device.


1 Answers

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.

like image 113
FoamyGuy Avatar answered Sep 27 '22 19:09

FoamyGuy