varunkr
varunkr

Reputation: 5542

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 i.e 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!!

Upvotes: 0

Views: 491

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006664

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.

Upvotes: 1

Related Questions