Excepción de permiso a pesar de que el permiso se establece en manifiesto [duplicado]
Esta pregunta ya tiene una respuesta aquí:
l permiso de Android no funciona incluso si lo he declarad 11 respuestasEn mi manifiesto tengo:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
Sin embargo, cuando ejecuto mi aplicación y presiono el botón que necesita este permiso, obtengo la siguiente excepción:
Geofence usage requires ACCESS_FINE_LOCATION permission
¿Cómo puedo arreglar esto
Tengo el permiso justo debajo de<manifest>
Estoy usando Android 6.
Este es mi código:
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);
}
}