Android Persist Data After Uninstall(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 卸载后保留数据
基础教程推荐
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01