奇怪的是,如果我运行以下代码,我会在SUCCESS
回调中获得onRemoveGeofencesByRequestIdsResut()
statusCode。
ArrayList<String> geofencesToRemove = new ArrayList<String>();
geofencesToRemove.add("does this actually work?");
MainActivity.
mLocationClient.
removeGeofences(geofencesToRemove, new LocationClient.OnRemoveGeofencesResultListener() {
@Override
public void onRemoveGeofencesByRequestIdsResult(int statusCode, String[] strings) {
if (statusCode == LocationStatusCodes.GEOFENCE_NOT_AVAILABLE) {
Log.i("geofence info", "geofence not available to remove");
} else if (statusCode == LocationStatusCodes.ERROR){
Log.i("geofence info", "error. geofence not removed");
} else if (statusCode == LocationStatusCodes.SUCCESS){
Log.i("geofence info", "geofence successfully removed");
}
}
@Override
public void onRemoveGeofencesByPendingIntentResult(int i, PendingIntent pendingIntent) {
}
});
我不应该获得SUCCESS
statusCode的原因是removeGeofences()
接受geofenceIds列表(Ids是字符串),显然字符串“这实际上有用吗?”不是geofenceId。
那么,有谁知道为什么我会得到这个意想不到的结果?这是Geofence API的错误吗?