Android has a built-in backup mechanism that can save and restore application data. When application backup is enabled, local data from your application can be exported to Google Cloud or to an external device via adb backup. Enabling Android backup exposes your application to disclosure of sensitive data. It can also lead to corruption of local data when restoration is performed from an untrusted source.

By default application backup is enabled and it includes:

Ask Yourself Whether

There is a risk if you answered yes to any of those questions.

Recommended Secure Coding Practices

Sensitive Code Example

<application
    android:allowBackup="true"> <!-- Sensitive -->
</application>

Compliant Solution

Disable application backup.

<application
    android:allowBackup="false">
</application>

If targeting Android 6.0 or above (API level 23), define files to include/exclude from the application backup.

<application
    android:allowBackup="true"
    android:fullBackupContent="@xml/backup.xml">
</application>

See