Android “remembers” shared preferences after complete app uninstall

后端 未结 3 587
耶瑟儿~
耶瑟儿~ 2020-12-20 06:59

In my Android app I use a set of randomly generated file names to store some data. In order to ensure that the same set of file names are generated at app restart - and are

3条回答
  •  心在旅途
    2020-12-20 07:52

    On (re)install, your app may be restoring files from Google auto-backup (via Google Drive). To disable this feature, you can explicitly set it to false in the manifest:

    
        ...
        
            ...
        
    
    

    If you'd like more granular control over what is backed up/restored and what is not, you can include or exclude specific files from the backups.

    See auto backup documentation: https://developer.android.com/guide/topics/data/autobackup#EnablingAutoBackup

    If you don't want to disable auto backups, but want to reinstall with a "clean slate" (for testing purposes), you can do one of the following:

    • Clear app data after reinstall. This will wipe out files that were restored automatically on install
    • Clear app data prior to uninstall, then force a new backup (so old one gets reset) by using this command: adb shell bmgr backupnow

    See how to test backups documentation: https://developer.android.com/guide/topics/data/testingbackup#TestingBackup

提交回复
热议问题