I'm building an app which includes googles geofences, which i created with both ENTER and EXIT transitions.
The problem occurs when turning "Location" on, when inside my geofence, it triggeres both transitions, when only the ENTER transition should trigger.
Ive set both ENTER and EXIT as intitialTrigger()
.
How this can be possibel ?
Is it a fault in the google api or have i done something wrong in the builder. Thanks in advance.
@Override
public void onResult(Result result) {
Status s = result.getStatus();
Log.d(TAG, "onResult(...)" + s.isSuccess());
if (!s.isSuccess()) {
Log.d(TAG, "statuskode = " + s.getStatusCode() +
" noget gik galt, sandsynlighvis blev gps slået fra = statuscode 1000");
}
}
private GeofencingRequest createGeoFences() {
return new GeofencingRequest.Builder()
.addGeofence(geoFenceBuilder(Constants.LOCATION_BALLERUP, "ballerup_req_id"))
.addGeofence(geoFenceBuilder(Constants.LOCATION_AALBORG, "aalborg_req_id"))
.addGeofence(geoFenceBuilder(Constants.LOCATION_ESBJERG, "esbjerg_req_id"))
.addGeofence(geoFenceBuilder(Constants.LOCATION_ÅRHUS, "århus_req_id"))
// .addGeofence(geoFenceBuilder(Constants.LOCATION_TAASTRUP, 44))
.setInitialTrigger(GeofencingRequest.INITIAL_TRIGGER_ENTER | GeofencingRequest.INITIAL_TRIGGER_EXIT)
.build();
}
private Geofence geoFenceBuilder(LatLng location, String requestId) {
return new Geofence.Builder().setCircularRegion(location.latitude, location.longitude, TARGET_RADIUS)
.setExpirationDuration(Geofence.NEVER_EXPIRE)
.setTransitionTypes(Geofence.GEOFENCE_TRANSITION_ENTER | Geofence.GEOFENCE_TRANSITION_EXIT)
.setRequestId(requestId)
.setNotificationResponsiveness(NOTIFICATION_DELAY)
.build();
}