简体   繁体   中英

How to get emulated storage path on Android 6?

I want to get the emulated storage path. System.getenv("EMULATED_STORAGE_TARGET") works on previous versions ie Android 5 and below but returns null on Android 6. I searched on google but couldn't find anything. How can I get the emulated storage path on Android 6. Any help will be appreciated. Thanks in advance!!

You appear to be referring to external storage , which on some versions of Android will be located at /storage/emulated/0/ . The proper way to obtain the root of external storage, on all versions of Android, is by means of Environment.getExternalStorageDirectory() .

If you find yourself using environment variables in an Android app, you are doing it wrong.

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