Welcome all
I have tried every question related to this in Stackoverflow and google and none of them works. I have tried something like this next link, but it returns the same as internal storage: How to get an External storage sd card size (With Mounted SD card)?
For example, if I have about 12GB internal storage and 4GB SD card storage, no matter what method I use, I always get the exact same number for the SD space as I do for internal space.
It seems that the old methods posted here in Stackoverflow only works until Android KitKat but do not work in next android versions.
Is possible to solve this?
Ok, I've always wondered this and couldn't find an answer online. So here's what I do. It might not be so clean but it works for me every time.
For my case: it returns 61,055 MB. I have a 64 GB sd card inserted.
Oh and I forgot to mention: I did this on Samsung Galaxy S5 6.0 and Sony Xperia Z5 Premium 5.1.1 today to confirm. However, I also have an app that few hundred people use daily and I haven't experienced any issues yet.
My phone has a built-in storage of 32GB and SD Card of 15GB. Doing a
df
on/mnt/sdcard
gives a 32GB result, which is not what we are looking for. Digging further, I found this/storage
directory. It has 3 files in there:doing a
df
on each item gives the following:I think the magic command is
"df /storage/" + mFilesArray[0]
wheremFilesArray[]
is the result fromls /storage
.(Let's hope that Google guys don't change the SD Card mount point in the future, which I doubt.)
Hope this helps.