Android 2.1 以编程方式卸载 SDCard

发布于 2024-12-05 03:55:13 字数 260 浏览 4 评论 0原文

我有一个应用程序,它将重要数据写入 SDCard 并使用 AES 对其进行加密,稍后将由桌面应用程序使用。我注意到,如果我不从“设置”菜单中卸载 SDCard,有时文件根本不会写入,或者已损坏。

在 Android 2.1 中是否可以通过编程方式卸载 SDCard?因为我很确定用户有时会忘记这样做,而我将是解决问题的人,我真的不希望这样。

如果这不可能,我应该使用什么 Linux 命令来卸载 SDCard?由于该应用程序将在某些具有 root 操作系统的平板电脑上运行。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吾性傲以野 2024-12-12 03:55:13

例如,您应该以正确的顺序卸载正在使用 SD 卡的内容,

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

或者,可能将缓冲区与文件系统同步就足够了

sync; sync

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文