简体   繁体   中英

Android 4.4 - create application dir on secondary sd card

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!!!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM