0

I have an application that can have multiple users on the device. I have a counter that needs to be read and updated across all users. Is there a way that this variable can persist across all user profiles?

We want to avoid using Settings.Global since all applications would have access to the variable and we would like to make it so it is accessible only for our app.

SharedPreference is user specific so that won't be an option.

We could save to a file but then again another team who has access to the source code may be able to access and edit the variable. Maybe there is a way for only our application to have write access to the file?

Is SqlDelight user-specific? I haven't found a concrete answer to that online.

user3826764
  • 198
  • 1
  • 9

1 Answers1

0

If I understand you correctly, internal storage is what you're looking for. Only your app can access the directory, other apps can't. No need for permission and all data removes if app removes.

More info in official docs about differece of storages: https://developer.android.com/training/data-storage

and here is for internal storage specifically: https://developer.android.com/training/data-storage/app-specific

ZaberZiv
  • 49
  • 7