сключение @Permission, даже если в манифесте установлено разрешение [duplicate]
На этот вопрос уже есть ответ:
Разрешение Android не работает, даже если я объявил об этом 11 ответовВ моем манифесте у меня есть:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
Однако когда я запускаю свое приложение и нажимаю кнопку, для которой требуется это разрешение, я получаю следующее исключение:
Geofence usage requires ACCESS_FINE_LOCATION permission
Как я могу это исправить
У меня есть право на<manifest>
Я использую Android 6.
Это мой код:
public void addGeofencesButtonHandler(View view) {
if (!mGoogleApiClient.isConnected()) {
Toast.makeText(this, getString(R.string.not_connected), Toast.LENGTH_SHORT).show();
return;
}
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);
}
}