How to find the available space in SD Card?

  • Hi,

    I have to find the space available in the Internal storage/SD card which is the device, So I can inform the user to download the maps there.
    How to find the available space in InternalStorage[Phone memory/]SD Card in Andorid Device/iPad tablets.

    Thanks In advance.

  • Moderators

    Following Java code can be used (Can be easily used from JNI if needed)

    // android.os.StatFs
    StatFs stat = new StatFs(Environment.getExternalStorageDirectory().getPath());
    long bytesAvailable = (long)stat.getBlockSize() *(long)stat.getBlockCount();

Log in to reply