How to create a dynamic Geofence with android

1k Views Asked by At

I'm learning how to use a Geofence with android and my question is : If I have a list of places (lat and long) with a realtime database, I would have to create a new object of Geofence everytime that something new is listed? Like this :

Geofence geofence = new Geofence.Builder()
.setRequestId(GEOFENCE_REQ_ID) // Geofence ID
.setCircularRegion( LATITUDE, LONGITUDE, RADIUS) // defining fence region
.setExpirationDuration( DURANTION ) // expiring date
// Transition types that it should look for
.setTransitionTypes( Geofence.GEOFENCE_TRANSITION_ENTER | Geofence.GEOFENCE_TRANSITION_EXIT )
.build();

Here setCircularRegion( LATITUDE, LONGITUDE, RADIUS) would be pass the locations ? And how to dandle which one was ? https://developer.android.com/training/location/geofencing.html

0

There are 0 best solutions below