当应用程序被强制移动到 SD 卡时,SharedPreferences 会去哪里?
我有一个 Android 应用程序,它有一个服务,并且只能在内部安装。然而,一些具有ROOT权限的用户将其安装在SD卡上并报告各种奇怪的错误。
当用户这样做时,SharedPreferences 会去哪里?它们是否也存储在 SD 卡上(对我来说真的很糟糕,因为我经常写它们)或者它们始终存储在内部存储中?我看到的一些错误似乎表明了这种情况。
如果是这样,我如何检测我的 SharedPreference 文件确实位于 SD 卡上?
谢谢!
I have an Android App which has a service and this should only be installed internally. However some users with ROOT are installing it on SD-Card and are reporting all kinds of strange errors.
When a user does that, where do the SharedPreferences go? Are they also stored on SD-Card (really bad for me as I write them often) or are they always on internal storage? Some of the errors I've seen seem to indicate this situation.
If so, how do I detect that my SharedPreference file is indeed on the SD-Card?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当应用程序移动到 SD 卡时,只有 .apk 会移动到 /mnt/asec/package_name/pkg.apk。 Shared_prefs、缓存、数据库等目录和文件保留在 /data/data/package_name 下的 /data 分区上。
我在运行 Bugless Beast 0.6.2.1 的 root Moto Droid 1 上检查了这一点。
仅供参考,服务将从已移至 SD 卡的应用程序正常运行。移动到 SD 卡的唯一问题是,当卸载 SD 卡时,您的应用程序(及其服务)将无法运行。
When the app is moved to the SD card, only the .apk is moved to /mnt/asec/package_name/pkg.apk. The shared_prefs, cache, databases, etc. directories and files remain on the /data partition under /data/data/package_name.
I checked this on my rooted Moto Droid 1 running Bugless Beast 0.6.2.1.
FYI, services will run fine from an app that has been moved to the sd card. The only issue with moving to the sd card is that when the sd card is unmounted, your app (and it's services) won't be able to run.