Android - ask write to SD card permission dialog

前端 未结 2 1127
栀梦
栀梦 2021-01-06 02:51

I am having trouble gaining write access to device SD card root directory. I can write to device internal storage and app package folder in an SD card without problems. I fo

2条回答
  •  佛祖请我去吃肉
    2021-01-06 03:31

    Unfortunately, using createAccessIntent is now deprecated in Android Q, and the documentation states that if you use it in Android Q, it will immediately return RESULT_CANCELED.

    They recommend you use an intent with ACTION_OPEN_DOCUMENT_TREE.You can specify the directory it opens initially (which is only supported on Android O and above), making it easier for the user, but this still is not a very user friendly approach.

    I'm wondering if there are any other user friendly solutions that anyone knows of? I don't understand why Android removed createAccessIntent, as it seems to be the most user friendly way.

提交回复
热议问题