Question

Initially, I have added 5 geofences to LocationClient.

After some time I need to add new geofences, say 3.

What shall I do to have all 8 geofences active.

Shall I remove initial 5 geofences and add all 8 at once. OR Shall I add 3 new geofences as below.

Intent geofenceIntent = new Intent(this, GeofenceIntentService.class);
PendingIntent pIntent = PendingIntent.getService(this,
                                                 0,
                                                 geofenceIntent,
                                                 PendingIntent.FLAG_UPDATE_CURRENT);
locationClient.addGeofences(geofences, pIntent, LocationIntentService.this);    
Était-ce utile?

La solution

I believe you have a database storing all geofence info. When adding a new geofence, you can first record it into the database. And then retrieve all geofences in the databse, and add them all to the locationClient as new geofences.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top