What's the best way to update geofences in Android? Is it to first remove the old set of Geofences and then add the newly updated list like this:
LocationServices.GeofencingApi.removeGeofences(
mGoogleApiClient,
getGeofencePendingIntent()
).setResultCallback(this);
LocationServices.GeofencingApi.addGeofences(
mGoogleApiClient,
getGeofencingRequest(),
getGeofencePendingIntent()
).setResultCallback(this); // Result processed in onResult().
Or can I just directly call addGeofences
without removing the old ones and have the new one's replace the old?
If you read the manual first, you'd notice that addGeofences says that:
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.