问题
I am aware about changes in Access to SD card introduced by Google with Android 4.4. However in my application I need to be able to store data on some removable /secondary sd card.
When I create the application folder (app.xyz.com) on the secondary using default file manager then I am able to create dirs and files inside. But by default such dir dosen't exist on secondary sd card.
So, I would like to create the application specific dir programmatically inside my application…
Do you have any idea how to do this??? Simple file.mkdirs(), even with the correct application related path, doesn’t work. Permission error…
I have spend already two days trying to find a way, without any success
THANKS FOR YOUR HELP!!!
回答1:
Do you have any idea how to do this?
Use getExternalFilesDirs()
(note the plural). If that returns more than one entry, the second and subsequent ones are on removable media. Those directories you can read and write to without any permissions on Android 4.4.
来源:https://stackoverflow.com/questions/26006040/android-4-4-create-application-dir-on-secondary-sd-card