cordova-plugin-android-permissions icon indicating copy to clipboard operation
cordova-plugin-android-permissions copied to clipboard

Can't request WRITE_EXTERNAL_STORAGE on android 7

Open Plurilogic opened this issue 7 years ago • 8 comments

Can't request WRITE_EXTERNAL_STORAGE on android 7, requestPermission simply returns with status.hasPermission set to false.

It does not request for permission.

The same will work if I ask for the CAMERA permission.

Plurilogic avatar Mar 14 '18 17:03 Plurilogic

I get same with READ_EXTERNAL_STORAGE

Gillardo avatar Mar 27 '18 09:03 Gillardo

Hi there - same is happening with READ_CONTACTS or GET_ACCOUNTS or WRITE_CONTACTS... Thanks

bpocallaghan avatar Apr 12 '18 06:04 bpocallaghan

Just want to add. It seems that it is working if you upgrade cordova to the latest version (cli-8.0.0). I removed my other plugins for the build to work - however it did ask me. Will update the current plugins and hopefully all should be good again. Please shout if this also worked for you or not? Thanks and Happy Coding...

bpocallaghan avatar Apr 12 '18 08:04 bpocallaghan

@bpocallaghan,

I'm having the same issue, and am currently running cordova 8.0.0. I literally cannot request the permission

mikeThurmond avatar Sep 20 '18 23:09 mikeThurmond

Hi @mikeThurmond Seems the hook did not work, honesty not sure if this will work, as I did not work with this package since then (only do phonegap apps every so often) Below is all the packages I have in my config for when I wanted to use the contacts plugin as well.

<preference name="phonegap-version" value="cli-8.0.0" />
    <preference name="deployment-target" value="8.0" />
    <preference name="android:minSdkVersion" value="16" />
    <preference name="android-targetSdkVersion" value="26" />
    <preference name="android-build-tool" value="gradle" />
    <preference name="AndroidPersistentFileLocation" value="Compatibility" />
    <engine name="cordova" spec="^8.0.0" />
    <engine name="cordova-ios" spec="^4.3.1" />
    <plugin name="cordova-plugin-device" spec="^2.0.1" />
    <plugin name="cordova-plugin-file" spec="^6.0.1" />
    <plugin name="cordova-plugin-geolocation" spec="^4.0.1" />
    <plugin name="cordova-plugin-inappbrowser" spec="^2.0.2" />
    <plugin name="cordova-plugin-network-information" spec="^2.0.1" />
    <plugin name="cordova-plugin-statusbar" />
    <plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
    <plugin name="cordova-plugin-analytics" spec="^1.4.3" />
    <plugin name="phonegap-plugin-barcodescanner" spec="^7.1.1" />
    <plugin name="cordova-plugin-sms" spec="^1.0.5" />
    <plugin name="cordova-plugin-contacts" spec="^3.0.1" />
    <plugin name="cordova-plugin-android-permissions" spec="^1.0.0" />
    <plugin name="cordova-plugin-camera" spec="^4.0.2" />
    <plugin name="cordova-plugin-advanced-http" spec="^1.11.1" />

Hopefully you notice something, or the package owner will be able to assist more. :)

bpocallaghan avatar Sep 21 '18 05:09 bpocallaghan

@bpocallaghan, Thanks for responding. I actually edited a hook I found online to request WRITE_EXTERNAL_STORAGE and it works.

mikeThurmond avatar Sep 21 '18 15:09 mikeThurmond

This is still an issue. requestPermission acts exactly like checkPermission for CAMERA and MANAGE_EXTERNAL_STORAGE permissions. Not working on Cordova 9.0.1. Fails with no errors or logs output.

CyberCyclone avatar Mar 16 '20 04:03 CyberCyclone

Just for information, the WRITE_EXTERNAL_STORAGE can only be requested for API 30+(android 11). The plugin does not support a mechanism for requesting this permission. To solve the issue i developed a plugin, which requests the permission. https://github.com/GAGANsinghmsitece/cordova-manage-external-storage

GAGANsinghmsitece avatar Apr 13 '22 14:04 GAGANsinghmsitece