Reputation: 61
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?
Upvotes: 2
Views: 2868
Reputation: 1179
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
Upvotes: 1
Reputation: 15423
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"
.
Upvotes: 6
Reputation: 2819
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.
Upvotes: 1