我正在尝试使用地理围栏,但我不想获得用户的确切位置。所以我正在使用 ACCESS_COARSE_LOCATION。如果我使用大的地理围栏点圈,我认为 ACCESS_COARSE_LOCATION 会正常工作。可能工作不完美,但它可以大致了解用户位置。
在这样的文档代码中
try {
LocationServices.GeofencingApi.addGeofences(
mGoogleApiClient,
// The GeofenceRequest object.
getGeofencingRequest(),
// A pending intent that that is reused when calling removeGeofences(). This
// pending intent is used to generate an intent when a matched geofence
// transition is observed.
getGeofencePendingIntent()
).setResultCallback(this); // Result processed in onResult().
} catch (SecurityException securityException) {
// Catch exception generated if the app does not use ACCESS_FINE_LOCATION permission.
logSecurityException(securityException);
}
但它给出了错误,因为 GeofencingApi.addGeofences 需要 FINE_LOCATION 权限。如何将地理围栏与 COARSA_LOCATION 一起使用