简体   繁体   English

如何将数据安全地存储在 Android 上,以便在重新安装后仍然有效?

[英]How can I securely store data on Android that will survive a reinstall?

Looking at older posts here on Stack Overflow, it appears this is not possible.查看 Stack Overflow 上的旧帖子,这似乎是不可能的。 But I'm wondering if there are any newer SDK APIs that support this ability?但我想知道是否有任何更新的 SDK API 支持此功能?

In my specific case, I need to create a UUID the first time my app runs because Android doesn't allow you to access a unique, hardware-based Device ID.在我的特定情况下,我需要在我的应用程序第一次运行时创建一个 UUID,因为 Android 不允许您访问唯一的、基于硬件的设备 ID。 I use my UUID instead which works great unless the user uninstalls then reinstalls later, in which case a new UUID is created and the user has lost access to their old data.我改用我的 UUID,除非用户卸载然后重新安装,否则我会使用我的 UUID,在这种情况下会创建一个新的 UUID,并且用户无法访问他们的旧数据。

If there is no Android API to do this, perhaps there's a way to do it using the Google Account they're currently signed into the device with, which would store the UUID in the cloud somehow?如果没有 Android API 来执行此操作,也许有一种方法可以使用他们当前登录设备的 Google 帐户来执行此操作,这会以某种方式将 UUID 存储在云中?

you could FirebaseAuthentification, its based on Email (Google account) for example and UID FirebaseAuth您可以使用 FirebaseAuthentification,例如它基于 Email(Google 帐户)和 UID FirebaseAuth

Android, and iOS, by design, delete all of an apps data when the app is removed from a phone. Android 和 iOS 设计为在从手机中删除应用程序时删除所有应用程序数据。

To do what you are talking about would require some sort of authentication API that lives elsewhere (think backend service).要执行您所说的操作,需要在其他地方进行某种身份验证 API(想想后端服务)。 You could build your own or use some of the existing authentication frameworks;您可以构建自己的或使用一些现有的身份验证框架; however, you would still need to manage the persisting of the data you want to store, as well as retrieving it.但是,您仍然需要管理要存储的数据的持久性以及检索数据。 Authentication would simply allow you to associate a user to a set of data.身份验证只允许您将用户与一组数据相关联。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM