I'm not sure what the source of the problem is - older android version with bug or if I'm doing something wrong, but my problem is that no matter what I do, android reports the SD card as mounted. Even if it's not physically in the tablet (archos 7o)..
public boolean saveToDisk(String filename, String header) {
/* first check to see if the SD card is mounted */
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
//throw some exception so we can display an error message
// XXX
return false;
}
try {
File root = Environment.getExternalStorageDirectory();
File dir = new File(root.getAbsolutePath() + "/bioz");
if (!dir.exists()) {
dir.mkdirs();
}
File file = new File(dir, filename);
....
The first test is always true, getExternalStorageDirectory() responds with /mnt/storage and the test to see if /mnt/storage/bioz exists indicates that the directory does exist.
Any idea what's going on? Am I doing something wrong, is the API broken, or something else?
Thanks, Reza