I have this code, that should be executed, when SD card is removed from an Android device (by remove, I understand, that user selects remove
from Android device menu or configuration, just as you remove USB device or SD card from any other system, before phisically removing the card):
public void kartkontrol()
{
String state = android.os.Environment.getExternalStorageState();
if (state.equals(android.os.Environment.MEDIA_MOUNTED))
{
// We can read and write the media
Durum=" Hafıza Kartı Var (Okuma/Yazma)";
}
else if (android.os.Environment.MEDIA_MOUNTED_READ_ONLY.equals(state))
{
// We can only read the media
Durum=" Hafıza Kartı Var (Okuma İzni)";
}
else
{
// No external media
Durum=" Hafıza Kartı Yok";
}
}
Card should be uninstalled and removed, but it seems, that it is actually installed during this process.
What am I doing wrong?