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.)
Whereas the Emulator running Android 5.1 shows SD card memory.
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.
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);