1

Looking at older posts here on Stack Overflow, it appears this is not possible. But I'm wondering if there are any newer SDK APIs that support this ability?

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. 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.

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?

Bungles
  • 1,969
  • 2
  • 25
  • 54
  • What do you mean by securely? Does this mean storing data in the device's internal storage, even encrypted, would not be secure enough for you? Keep in mind that internal storage (emulated sd card) and the app's data directory alike can both be accessed by (rooted) users. Or maybe you don't want your app to request storage permissions? – angleKH Sep 13 '22 at 22:58
  • "in which case a new UUID is created and the user has lost access to their old data" -- their old data is gone anyway, as it will go away for the same reasons the UUID did. – CommonsWare Sep 13 '22 at 23:40
  • By securely I just meant not in a public directory. If I have to use a public directory I'll encrypt the UUID, but would be easier to rely on Android's security if it's there. Their old data is stored on our servers and the UUID is the key to that data. We can retrieve their data if the UUID survives the reinstall. – Bungles Sep 14 '22 at 00:24

2 Answers2

0

you could FirebaseAuthentification, its based on Email (Google account) for example and UID FirebaseAuth

Gaya Touak
  • 56
  • 5
0

Android, and iOS, by design, delete all of an apps data when the app is removed from a phone.

To do what you are talking about would require some sort of authentication API that lives elsewhere (think backend service). 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.

BlackHatSamurai
  • 23,275
  • 22
  • 95
  • 156
  • 1
    On iOS one can use the keychain, which is saved to the cloud and AFAIK not deleted. Nothing similar exists on Android though, AFAIK. – Bungles Sep 14 '22 at 16:07