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
  • 37,241
  • 25
  • 195
  • 267
Ovidiu Latcu
  • 71,607
  • 15
  • 76
  • 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
  • 65,697
  • 9
  • 111
  • 134