Pregunta

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);    
¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top