ACTION OPEN DOCUMENT TREE only returns empty Recent folder

后端 未结 4 1528
眼角桃花
眼角桃花 2021-02-05 18:14

I have carefully copied the following code snippet from an earlier posting and it works, on the simulator and also on my Nexus 9 device, up to a point !

However, all I g

4条回答
  •  醉话见心
    2021-02-05 18:32

    Others mentioned the option on DocumentsUI which the user should manually enable. However there is another option. Add these extras on to your ACTION_OPEN_DOCUMENT, ACTION_GET_CONTENT ,ACTION_CREATE_DOCUMENT or ACTION_OPEN_DOCUMENT_TREE intent. Explore button on Storage settings uses these extras while opening DocumentsUI app. I think the first one is enough to show Internal storage and sdcard. The others are good to have.

    intent.putExtra("android.content.extra.SHOW_ADVANCED", true);
    intent.putExtra("android.content.extra.FANCY", true);
    intent.putExtra("android.content.extra.SHOW_FILESIZE", true);
    

    Android 10

    I tried on Android 10 emulator and OnePlus 7T, "SHOW_ADVANCED" extra does not do anything. User should manually click to "Show Internal storage" on the three dot menu. SDCards are visible by default.

提交回复
热议问题