To enable or disable android app from being backed up or restored you can use AndroidManifest.xml file and android:allowBackup=”false” which if present and is set to false will prevent even a full-system backup that would otherwise cause all application data to be saved via adb. The default value of this attribute is true. For example:
<?xml version='1.0' encoding='utf-8'?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" tools:replace="allowBackup" android:allowBackup="false"/>
Please note that I also used:
xmlns:tools=“http://schemas.android.com/tools” and tools:replace=“allowBackup”
The use of tools:replace=“allowBackup” is just to make sure that, if one of the libraries which my mobile app is using, also contains AndroidManifest.xml file and that manifest file also contains the android:allowBackup property which is set to true, the edits I have made in will have a higher priority and android:allowBackup in sub-manifest file will be overridden.