Android 2.1的编程方式卸载SD卡 [英] Android 2.1 programatically unmount SDCard

查看:109
本文介绍了Android 2.1的编程方式卸载SD卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有写入重要数据到SD卡和使用AE​​S,以后将被用于桌面应用程序进行加密的应用程序。我注意到,如果我不卸载从设置菜单有时文件没有写在所有的SD卡,或已损坏。

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.

反正在Android 2.1系统,我可以卸载SD卡编程?因为我是pretty的肯定,不时的用户会忘记这样做,我会成为一个固定的问题,我真的不希望这样。

Is there anyway in Android 2.1 that I can unmount the SDCard programatically? 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.

如果这是不可能的,什么Linux命令我应该用卸载SD卡?由于应用程序将运行在某些平板电脑有一个根深蒂固的操作系统。

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.

感谢。

推荐答案

您应该卸载什么用正确的顺序的SD卡,例如:

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

这篇关于Android 2.1的编程方式卸载SD卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆