Android 9.0 - How to find if user has inserted a corrupted sd card?

67 views Asked by At
Environment.getExternalStorageState().equalsIgnoreCase(Environment.MEDIA_MOUNTED_READ_ONLY)//corrupted -sd card 

But whenever I insert a corrupted sd card, the status is always "mounted", is this approach wrong?

1

There are 1 answers

0
Kishy Nivas On BEST ANSWER

I solved it by finding whether the inserted card is read-only or not, by traversing the /proc/mounts file and checking whether read_options of sdcard's mounted_directory is read-only or read-write.