Can I store data on an Android device to persist between installs?

后端 未结 3 1732
北恋
北恋 2020-12-31 10:04

I want to store a small amount of data in a way where it persists between application installs. I obviously can\'t use SharedPreferences as they are removes upon uninstallat

3条回答
  •  独厮守ぢ
    2020-12-31 10:45

    You can store the data in shared preferences and use a backup manager to have them backed up automatically. They should be restored once the app is reinstalled.

    There is no real way of blocking the app for certain persons. You could fore all your users to create an account to use the app and block the accounts but they always can recreate an account. You could store something on the SD-Card and check for it but malicious users can find that and delete it. You could try to get the user to authenticate themselves with their google account against your app (andlytics is using an authentication method like that) but the user can factory reset his phone and create a new google account.

    You have to choose how important the blocking of the users is and how much you want to annoy your other users because of some users that are not using your app as intended.

提交回复
热议问题