Android 4.4 Kitkat and second external storage

有些话、适合烂在心里 提交于 2020-01-01 06:45:12

问题


There has been written a lot about Kitkat external sdcard write permission but it's not clear to me how it works. Unfortunately I don't have Kitkat device with sdcard slot. Question is, can I write to secondary external storage at all? Based on the docs.

Apps must not be allowed to write to secondary external storage devices, except in their package-specific directories

If in understand it, If I don't have permission I can write to the app specific folder on primary external storage /sdcard/Android/data/package/... and to the app specific folder on secondary external storage /extSdcard/Android/data/package/...

and with WRITE_EXTERNAL_STORAGE I can write to all locations on primary external storage /sdcard/* but I can't write to any location on secondary external storage (except app specific folder)?

Thanks for all answers!


回答1:


Your analysis is correct, other than assuming that primary external storage is /sdcard (the exact path varies by device, OS level, and user account for Android 4.2+ tablets).

Here are some blog posts that I wrote recently on external storage and removable ("secondary external") storage.




回答2:


I know this topic is old but this may help. You should use this method.

System.getenv();

see project Environment3 to access all storage that is connected to your device.

https://github.com/omidfaraji/Environment3



来源:https://stackoverflow.com/questions/23199954/android-4-4-kitkat-and-second-external-storage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!