0

The below code shows me that the MediaScanner has started on the sdcard, after it ejects why? and what is happening?

if(intent.getDataString().equals("file:///mnt/extsd"))
        {
            if(Intent.ACTION_MEDIA_SCANNER_STARTED.equals(intent.getAction()))
            {
                //Media scanner is started
            }
            else if(Intent.ACTION_MEDIA_SCANNER_FINISHED.equals(intent.getAction()))
            {
            }
        }
Sojurn
  • 475
  • 6
  • 15

1 Answers1

1

Probably this question will be helpfull Its about /mnt/extsd and how to use SD card properly (means Environment.getExternalStorageDirectory()). Also you have to check the SD card state. I mean like:

boolean isExternalStorageWriteable = false, isExternalStorageReadable = false;
// Check SD Card for Read/Write
if (Environment.MEDIA_MOUNTED.equals(state)) {
    // We can read and write the media
    isExternalStorageWriteable = true;
    isExternalStorageReadable = true;
} else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
    // We can only read the media
    isExternalStorageReadable = true;
} 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
}
Community
  • 1
  • 1
Stan
  • 6,511
  • 8
  • 55
  • 87
  • Thing is, /mnt/sdcard IS the output of Environment.getExternalStorageDirectory() but that link is helpful nonetheless – Sojurn Mar 07 '13 at 04:43
  • actually you have to check the SD card state also. I mean like in code below. – Stan Mar 07 '13 at 08:17