androidgeofencingandroid-geofence

How to change the Radius of an Already created Geofence without getting same IDs multiple times


Scenerio : I have created a Geofence with ID=1 with say Radius=500 now i update the same Geofence with ID=1 to Radius=1000.

What I did : I re-registered the same Geofence ID and I get a message as Success GeofenceRequestIds=[1, 1] (two similar ids) .

Now as i keepon modifying the Radius the message keeps on increasing the array of ids for eg. after 4 changes i get Success GeofenceRequestIds=[1, 1, 1, 1]

Question: Does this mean that I would get all these IDs when I receive the transition (Breaching of geofence) of my GeoFence ID:1.

Alternate query:Should i remove the Geofence Id first before changing the Radius and then again add it on the same location with changed radius, can it make a difference.

Suggestion on this would be great.


Solution

  • Answer is HERE:

    If an existing geofence with the same request ID is already registered, the old geofence is replaced by the new one, and the new pendingIntent is used to generate intents for alerts.