Search code examples
androidandroid-sdcardsd-cardstorage-access-frameworkandroid-intent-chooser

Storage access framework/Document tree Shows Empty Recent List


I am using Storage access framework to make the user grant write permission for Sd card. It is working fine with two of my devices running on Android lollipop and Marshmallow. But it it not working with One of my device running on Android lollipop.

It is showing empty recent list.

Screenshot

This is how I am starting the activity

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

I tried using the menu button but it was of no use.

Is there any workaround to make the user grant write permission/Add Sd card directory to recent list? Because it is working for a couple of other apps such as ES Explorer.


Solution

  • 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,42);