0

There is a strange function in some Android devices (at least Galaxy S7): they restore data (for example the SQLite database) when the application is reinstalled. This behavior interrupts my app because the data is supposed to be deleted during uninstallation.

How can I force Android to completely delete all that data when the app is manually uninstalled?

Vitaly
  • 41
  • 3

3 Answers3

3

You have to disable the backup from AndroidManifest.xml

android:allowBackup="false"
tools:replace="android:allowBackup"

N.B: If you use any third party library that use android:allowBackup="true" then it conflicts and give error. To resolve this and override the setting you also have to add tools:replace="android:allowBackup".

Md. Asaduzzaman
  • 14,963
  • 2
  • 34
  • 46
1

It is a privacy concern. It is recommended to disallow users to backup an app if it contains sensitive data. Having access to backup files (i.e. when android:allowBackup="true"), it is possible to modify/read the content of an app even on a non-rooted device.

Solution - use android:allowBackup="false" in the manifest file.

Read this post to know more about this: https://resources.infosecinstitute.com/android-hacking-security-part-15-hacking-android-apps-using-backup-techniques/

Original post: https://stackoverflow.com/a/43475593/5304075

Mahesh Kumaran
  • 887
  • 2
  • 12
  • 30
Arul
  • 1,031
  • 13
  • 23
1

For your question, it's simple. Just add the below line to your app's manifest file's <application> tag.

android:allowBackup="false"

This makes the app's data not to be saved when it is uninstalled.

Gourav
  • 2,746
  • 5
  • 28
  • 45