I need to grant 'android.permission.WRITE_EXTERNAL_STORAGE' permission.
Previously I used to use:adb shell pm grant <PACKAGE_NAME> <PERMISSION>.
This command is not working now with Android Q.
I realised that now android have added this permission into restricted category. when I do adb shell dumpsys package <PACKAGE_NAME>, I get:
android.permission.READ_EXTERNAL_STORAGE: restricted=true
android.permission.WRITE_EXTERNAL_STORAGE: restricted=true
...
...
...
android.permission.READ_EXTERNAL_STORAGE: granted=false, flags=[ USER_SENSITIVE_WHEN_GRANTED|USER_SENSITIVE_WHEN_DENIED|APPLY_RESTRICTION]
android.permission.WRITE_EXTERNAL_STORAGE: granted=false, flags=[ USER_SENSITIVE_WHEN_GRANTED|USER_SENSITIVE_WHEN_DENIED|APPLY_RESTRICTION]
android developer doc for WRITE_EXTERNAL_STORAGE
I've few questions where I need help:
- How to fix this problem using code?
- How can we grant these permission using adb?