1

We have an Android app written in Ionic 2/Cordova that uses an SQLite db on the device.

We've tested on 3 different android devices:

  • Xperia z5c on 7.1.1
  • Nexus 5x on 7.1.2
  • Samsung Galaxy S7

Results:

  • Sometimes when we update the app, the database appears to be blanked
  • Sometimes it retains its data.

This only happens on the Nexus and the Samsung

Is there a known bug with the update mechanism regarding SQLite or Cordova apps specifically?

Thanks.

Dave
  • 5,283
  • 7
  • 44
  • 66

1 Answers1

3

It may not be the cause of your problem, but I encountered a similar issue on some newer Samsung devices and it turned out that Android autobackup was to blame.

Since it's enabled by default on apps targeting Android 6.0 (API level 23) or higher, it was syncing the DB file from autobackup and therefore overwriting the freshly installed or updated version on the device.

There's some more info about it here, but in a nutshell, setting android:allowBackup="false" in the AndroidManifest.xml fixed it for me.

DaveAlden
  • 30,083
  • 11
  • 93
  • 155
  • Hmmm that's interesting as we did check that auto backup was disabled on the devices. But from what you're saying, it's happens regardless of that system toggle? Cheers. – Dave Mar 19 '18 at 16:15
  • I wouldn't think so if you've explicitly switched off backup - according to [the docs](https://developer.android.com/guide/topics/data/autobackup.html#BackupSchedule): `Backups occur automatically when all of the following conditions are met: The user has enabled backup on the device in Settings > Backup & Reset ...` – DaveAlden Mar 20 '18 at 10:12