Access external storage in File Chooser

前端 未结 1 1013
梦如初夏
梦如初夏 2020-12-20 03:12

I am trying to implement a File Chooser. I am using Android File Explore for file chooser in my app. When I run the app, it shows me Internal storage and returns me the file

1条回答
  •  死守一世寂寞
    2020-12-20 03:44

    In the above github link you are using Environment.getExternalStorageDirectory() API which is working as expected. I think you misunderstood the use of this API. This API will always return the primary external storage directory. Below explanation may help you:

    First of all, What is difference between Internal Storage, External Storage (aka primary external storage) and Secondary External Storage?

    Internal Storage: is storage that is not accessible by the user, except via installed apps (or by rooting their device). Example: data/data/app_packageName

    Primary External Storage: In built shared storage which is "accessible by the user by plugging in a USB cable and mounting it as a drive on a host computer". Example: When we say Nexus 5 32 GB.

    Secondary External Storage: Removable storage. Example: SD Card.

    Now next question. How to access SD card in Lollipop? To access SD card Android introduced new Storage Access Framework in KitKat.

    Here is one answer explained it beautifully: https://stackoverflow.com/a/26765884/631803

    0 讨论(0)
提交回复
热议问题