Android 卸载后保留数据

Android Persist Data After Uninstall(Android 卸载后保留数据)

本文介绍了Android 卸载后保留数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使在卸载应用程序后,我也必须为我的应用程序保留 2 个字符串.关于最终用户的设备没有 SD 卡并且他们没有互联网连接,即使在应用程序卸载后我怎么能保留这 2 个字符串?

I have to persist 2 strings for my application even after the application is uninstalled. Regarding that the end users don't have SD cards for their devices and they don't have internet connection, how could I persist those 2 strings even after the app is uninstalled?

我将非常感谢任何回应.谢谢

I would highly appreciate any response. Thanks

推荐答案

除非您的目标是非常旧的手机,否则您无需担心没有外部存储.只要您使用 Environment.getExternalStorageDirectory() 作为参考,您应该没有问题,但如果您对此非常担心,您可以检查外部存储是否不存在并且然后选择去内部存储.查看开发者文档中的此链接以获得更多信息.

Unless you're targeting VERY old phones, you don't need to worry about not having external storage. As long as you use Environment.getExternalStorageDirectory() as your reference, you shouldn't have a problem, though if you're absolutely concerned about this you can check if the external storage doesn't exist and then opt to go to internal storage. Check out this link from the developer docs for a little more insight.

如果 External 确实不可用,您可以保存到 Internal memory,但您必须为此声明一个新权限,这可能会阻止某些人.

If External truly isn't available, you could then save to Internal memory, but you will have to declare a new permission for that, which may ward off some people.

这篇关于Android 卸载后保留数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Android 卸载后保留数据

基础教程推荐