I have the WRITE_EXTERNAL_STORAGE permission designated in the manifest, and in the app when I call requestPermissions, the grantResult comes back with -1, meaning it's not granted. However, in Device Settings for the app, the Storage permission is showing as ON. The app will not let me write, however. Why is the grant request failing, and the permission denied as far as the app is concerned, but showing as fine in Settings?
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE}, PICK_FROM_GALLERY);
.
.
.
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, RESULT_LOAD_IMAGE);
} else {
//THIS IS WHERE I END UP WITH grantResults == -1
}
I found the answer. Evidently, something I'm pulling in from a 3rd party lib is causing a manifest merger. By adding this:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="replace"/>
my problem goes away.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With