0

I have an application that writes important data to the SDCard and encrypts it using AES, which later will be used by a desktop application. I have noticed that if I do not unmount the SDCard from the Settings menu sometimes the files don't get written at all, or are corrupted.

Is there anyway in Android 2.1 that I can unmount the SDCard programmatically? Because I'm pretty sure that from time to time the users will forget to do this, and I'll be the one fixing the problems and I really don't want this.

If this is not possible,what Linux command should I use to unmount the SDCard? Since the application will run on some tablets that have a rooted OS.

Cœur
  • 34,719
  • 24
  • 185
  • 251
Ovidiu Latcu
  • 70,421
  • 14
  • 74
  • 84

1 Answers1

1

You should unmount what's using the sdcard in the proper order, for example

umount /mnt/sdcard/.android_secure
umount /mnt/sdcard

or, probably synchronizing the buffers with the filesystem would be enough

sync; sync
Diego Torres Milano
  • 61,192
  • 8
  • 106
  • 129