2

I want to not backup sharedPref as those contains login info. I'm using below code to not allow backup for API > android12.

 <cloud-backup>
    <exclude domain="sharedpref" />
    <exclude domain="database" />
</cloud-backup>
<device-transfer>
    <exclude domain="sharedpref" />
    <exclude domain="database" />
</device-transfer>

Is this enough to prevent backing up of default sharedPref and any room db?

What is the best way / what else should I do to prevent that backup?

Delowara
  • 21
  • 2

1 Answers1

0

In your manifest add

<application
android:allowBackup="false"
android:fullBackupContent="false"
android:dataExtractionRules="@xml/data_extraction_rules"
tools:targetApi="s">

The data extraction rules must be

<data-extraction-rules>
<cloud-backup>
    <exclude domain="database" />
    <exclude domain="sharedpref" />
</cloud-backup>
<device-transfer>
    <exclude domain="database" />
    <exclude domain="sharedpref" />
</device-transfer>

Maybe this link might help.

Akamaccio
  • 79
  • 5
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/31932899) – TikTaZ Jun 07 '22 at 13:29
  • @TikTaZ: Your point is correct, I've edited the answer. – Akamaccio Jun 11 '22 at 13:42