3

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?

2

3 Answers 3

6

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".

Sign up to request clarification or add additional context in comments.

Comments

2

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

Comments

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.