Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Some Android devices treat Internal Storage as SD Cards and External Storage as EXTSD

I have a bunch of Android devices from different vendors.

Some of them attach /mnt/sdcard to internal storage and /mnt/extsd to external storage(Scenario 1) and others attach /mnt/sdcard to external storage(Scenario 2)

I think the second scenario is standard since the Android API provides a handle to this path. Now the problem is that in scenario 1, /mnt/extsd becomes readonly even with WRITE_EXTERNAL_STORAGE permission!

This means I can only read data from the actual external sd card and not be able to write to it.

Is there a workaround for this so I can write to the extsd folder ?

like image 280
Vrashabh Irde Avatar asked Mar 15 '13 05:03

Vrashabh Irde


Video Answer


1 Answers

Environment.getExternalStorageState() returns path to internal SD mount point like "/mnt/sdcard"

Environment.getExternalStorageDirectory() refers to whatever the device manufacturer considered to be "external storage". On some devices, this is removable media, like an SD card. On some devices, this is a portion of on-device flash. Here, "external storage" means "the stuff accessible via USB Mass Storage mode when mounted on a host machine", at least for Android 2.x and above.

But the question is about external SD. How to get a path like "/mnt/sdcard/external_sd" (it may differ from device to device)?

Android has no concept of "external SD", aside from external storage, as described above.

If a device manufacturer has elected to have external storage be on-board flash and also has an SD card, you will need to contact that manufacturer to determine whether or not you can use the SD card (not guaranteed) and what the rules are for using it, such as what path to use for it.

like image 67
Royston Pinto Avatar answered Oct 19 '22 22:10

Royston Pinto