GeofencerStateMachine:sendNewLocation可用性:添加地理围栏还没来得及,所以地理围栏不会触发

时间:2019-07-05 13:46:17

标签: java android android-geofence

Geofence有时不会触发(随机)。当我检查日志时未看到以下日志

GeofencerStateMachine: sendNewLocationAvailability: availability=LocationAvailability[isLocationAvailable: true]

用于未触发的地理围栏。但是它是由触发的地理围栏来的。

GeofencingClient mGeofencingClient = LocationServices.getGeofencingClient(this);

Geofence geofence = new Geofence.Builder()
    .setRequestId(tempKey)
    .setCircularRegion(lats[i], lngs[i], radius[i])
    .setExpirationDuration(Geofence.NEVER_EXPIRE) //Never Expires
    .setTransitionTypes(Geofence.GEOFENCE_TRANSITION_ENTER | Geofence.GEOFENCE_TRANSITION_EXIT)
    .build();

geofencingRequest = new GeofencingRequest.Builder()
    .setInitialTrigger(GeofencingRequest.INITIAL_TRIGGER_ENTER | GeofencingRequest.INITIAL_TRIGGER_DWELL)
    .addGeofence(geofence)
    .build();

PendingIntent mGeofencePendingIntent = PendingIntent
    .getBroadcast(currentActivity, 0, geolocationIntent, PendingIntent.FLAG_UPDATE_CURRENT);

mGeofencingClient.addGeofences(geofencingRequest, mGeofencePendingIntent);

我应该怎么做才能获得NewLocationAvailability,以便每次触发我的地理围栏?

0 个答案:

没有答案