Old data appears in SQLite database when reinstalling app

后端 未结 2 1939
后悔当初
后悔当初 2021-01-06 07:07

I\'ve got a Xamarin Forms app that uses an SQLite database to store user data, including a login token that I use for authenticating with a REST API.

I\'m getting a

相关标签:
2条回答
  • 2021-01-06 07:17

    As per the comment by @Commonsware, adding android:allowBackup="false" to the AndroidManifest.xml in the <application> tag prevented the old data from being restored.

    From the Android docs:

    android:allowBackup

    Whether to allow the application to participate in the backup and restore infrastructure. If this attribute is set to false, no backup or restore of the application will ever be performed, even by a full-system backup that would otherwise cause all application data to be saved via adb. The default value of this attribute is true.

    It's still not clear to me why doing a Debug deploy of an app that was currently installed would trigger a restore-from-backup event.

    0 讨论(0)
  • 2021-01-06 07:30

    Actually why do you want to store token in SQLite Table. You could use https://www.nuget.org/packages/Xam.Plugins.Settings/ to store token.

    0 讨论(0)
提交回复
热议问题