1

I want to provide my application with Write Permission for SD Card. I am trying to use Storage Access Framework to get thoose perissions.

But when i start the Activity using the following code.

startActivityForResult(new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE), 42);

i am getting the following empty Recent list with no other option to select Internal Memory or SD Card in my Phone (Android Version 5.1.)

Phone Screenshot

Whereas the Emulator running Android 5.1 shows SD card memory.

Emulator Screenshot

Could anyone please suggest what is wrong? Because couple of other applications(ES Explorer,MP3 Editer) asked for permission in my phone where i was able to select the SD Card.

2
  • Look in menu and enable option to show sd card and so.
    – greenapps
    Jan 28, 2017 at 18:30
  • There is no Menu Option at all. As you can see the Screenshot. I tried with menu key too. no use.
    – sathish ks
    Jan 28, 2017 at 18:35

1 Answer 1

3

I had the same problem and solved it by adding an extra to the Document Tree intent.

Intent intent = new Intent("android.intent.action.OPEN_DOCUMENT_TREE");
intent.putExtra("android.content.extra.SHOW_ADVANCED", true);
startActivityForResult(intent, REQUEST_CODE);
1
  • Didnt work for me, i can only use if i create a new folder
    – J. M.
    Jan 30, 2022 at 3:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.