Samsung galaxy S3 with no SD card, I'm using this code to check storage states.
Using this code:
boolean mExternalStorageAvailable = false;
boolean mExternalStorageWriteable = false;
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
// We can read and write the media
mExternalStorageAvailable = mExternalStorageWriteable = true;
} else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
// We can only read the media
mExternalStorageAvailable = true;
mExternalStorageWriteable = false;
} else {
// Something else is wrong. It may be one of many other states, but all we need
// to know is we can neither read nor write
mExternalStorageAvailable = mExternalStorageWriteable = false;
}
So perhaps someone can explain to me if this phone for some reason treats it's internal memory as external? Or what?
Android devices that use external storage (SD cards, basically) often have much less usable storage than is reported. That's because many system resources and some apps must be installed on the device's built-in core storage, not on a removable storage medium.
If you're seeing an "Insufficient storage available" message on your Android, chances are that you've used up most of your device's available memory. To fix this, you'll need to make some space by deleting apps and/or media; you can also add external storage, such as a Micro SD card, to your phone.
Step 1: Go to device “Settings” and select “Storage”. Step 2: Select your "SD Card", then tap the “three-dot menu“ (top-right), now select “Settings” from in there. Step 3: Now select “Format as internal”, and then “Erase & Format”. Step 4: Your SD Card will now be formatted as internal storage.
Empty Android's cached files If you've deleted all the files you don't need and you're still receiving the “insufficient storage available” error message, you need to clear out Android's cache.
getExternalStorageDirectory doesn't always return the SDCard.
Google doc says :
"don't be confused by the word "external" here. This directory can better be thought as media/shared storage. It is a filesystem that can hold a relatively large amount of data and that is shared across all applications (does not enforce permissions). Traditionally this is an SD card, but it may also be implemented as built-in storage in a device that is distinct from the protected internal storage and can be mounted as a filesystem on a computer."
There might be chances that "/mnt/sdcard" refers to the inbuilt storage for your phone.
It is better to check the return path from the getExternalStorageDirectory
method whether it is external removable storage or not.
You can use Environment.isExternalStorageRemovable() for checking it.
Android will always report one mounted hardware memory (if any available) as External Storage.
That memory can be:
A device can even have both, but Android will report only one of them (mostly internal one).
A simple way to get what is mounted where is adb shell mount
.
rootfs on / type rootfs (ro)
tmpfs on /dev type tmpfs (rw,nosuid,mode=755)
devpts on /dev/pts type devpts (rw,mode=600)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
tmpfs on /mnt/asec type tmpfs (rw,mode=755,gid=1000)
tmpfs on /mnt/obb type tmpfs (rw,mode=755,gid=1000)
/dev/block/mtdblock2 on /system type yaffs2 (ro)
/dev/block/mtdblock3 on /data type yaffs2 (rw,nosuid,nodev)
/dev/block/mtdblock1 on /cache type yaffs2 (rw,nosuid,nodev)
/dev/block/vold/179:1 on /mnt/sdcard type vfat (rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
/dev/block/vold/179:1 on /mnt/secure/asec type vfat (rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With