Android 14 unable to get rid of provisioned files

158 views Asked by At

I have the following device for testing the app:

Android Google Pixel 7a Android Version 14

App is created with delphi 12 Patch 1. App was installed before updateing to Android 13.

The app includes an SQLite database. The "initial installation" involves loading an empty database (without data, only tables and fields) via provisioning in .\assets\internal. Then, it's coupled with the application using:

Connection.Params.Values['Database'] := TPath.Combine(TPath.GetDocumentsPath,<DatabaseName>)

So far, so unspectacular.

Now, there are changes to the database structure. The application is not yet live (otherwise, I would handle it via an update script). I have made the adjustments to the database that is provided via provisioning.

My naive assumption was that I could simply uninstall the app on the device and reinstall it through Delphi, and then have the new DB. Unfortunately, that's not the case. I've encountered this behavior before (possibly Pixel-specific? It seems like the data is cached somewhere). Usually, I could resolve it by opening the app settings and then clearing both the cache and storage under "Storage and Cache". This used to work reliably even under Android 13. Since Android 14 on the device, it seems that this no longer works. I've tried deleting everything, even removing the database from the deployment as a test, but upon distributing the application again, the old database that was distributed long ago is back in the system.

I have absolutely no idea where it's pulling this from and how to get rid of it. Have you experienced this before? Any solutions or insights would be greatly appreciated.

2

There are 2 answers

0
blackapps On BEST ANSWER

allow backup manifest is to be removed.

0
fisi-pjm On

Android has had the feature of automatic backups of app settings since version 6. This means that if this feature is or was active on the smartphone and a backup exists on Google Drive, then this backup will be applied when the app is installed.

The process is as follows:

  • App gets installed
  • If a backup exists, the backup is restored (files are overwritten)
  • App is started for the first time

Note that this process only occurs once, namely when the app is not already installed on the device. This mechanism does not apply to updates.

The backup will also be restored even if you have already deactivated the automatic backup function but backups still exist in Google Drive.

Now there are, in my opinion, three ways to deal with this:

  1. Delete all backups and deactivate AutoBackup
  2. When developing and distributing the app, switch to airplane mode on the device (yes, the device retrieves the settings from the network each time)
  3. In the manifest file, either prohibit backup for the entire app or only for individual files

For more Information see: Android Autobackup

The manifest file also takes effect even if a backup already exists. This means that an existing backup will not be applied if the manifest file has autobackup set to false.

The problem is, of course, not specific to Pixel but to Android. Other manufacturers may prevent the automatic backup, which is why it may never have been activated there.