user3586231
user3586231

Reputation: 365

Android Multiple geofence alerts come even when user is at one place

I have made an application that alerts user when he enter/exit a particular place with the help of geofence api. now problem is that when user is inside a building then multiple geofence alerts(Enter/Exit) come after some time interval even user is at same place. Any suggestion to overcome this problem?

GeofencingRequest.Builder builder = new GeofencingRequest.Builder();
    builder.setInitialTrigger(Geofence.GEOFENCE_TRANSITION_ENTER |
            Geofence.GEOFENCE_TRANSITION_EXIT);     
    builder.addGeofences(geofenceList);

Upvotes: 0

Views: 1355

Answers (2)

Uncaught Exception
Uncaught Exception

Reputation: 2179

There is no guaranteed solution to this issue. Having said that, you can try out below methods to minimize the false alarms :

1) You must make use of the DWELL transition and LOITERING DELAY. This way, you will only get trigger if the user is in that particular geofence for an amount of time as declared by loitering delay.

Note: When I say 'use DWELL', I mean that you should do both: set DWELL transition as the initial trigger as well as filter for DWELL transition in your service when you receive the trigger.

2) Force the user to set a radius as big as your application can work with. I have tested with radius of upto 200 meters resulting in false alarms. So ask yourself the question: Will it make sense in my app if the user has to set a radius of min 0.5km ?

Upvotes: 0

Marian Paździoch
Marian Paździoch

Reputation: 9103

Unfortunately you can't. This is how geofencing works - it depends on cellular network and wifi networks you're near to. Those signals come and go and quite often you get false positives.

Upvotes: 1

Related Questions