mirror of
https://github.com/kuhyx/todo-app.git
synced 2026-07-04 12:03:10 +02:00
Enable Android Auto Backup of the notes DB and sync settings
OS-level safety net so a reinstall can restore data through Android's backup/restore flow. Sets allowBackup=true and points fullBackupContent (pre-31) and dataExtractionRules (API 31+) at empty rule sets, which back up the default locations: the app files dir (local CRDT DB todo.db), databases, and shared_prefs (GitHub sync settings + token). Backing up shared_prefs is intentional — it restores the sync config on reinstall so recovery needs no re-auth (zero-touch). The token is a narrowly-scoped contents-only PAT for the single private sync repo, kept in the user's own Google backup. Caveats: Auto Backup is scheduled (~daily, Wi-Fi+charging) so very recent changes may not be captured, and restore fires through the Play Store / device-setup flow, not an `adb install -r`. Auto-sync remains the primary durability path; this is the secondary net. Verified the attributes merge into the app manifest via a debug build. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
085287861c
commit
f9794512b4
@ -6,7 +6,10 @@
|
|||||||
<application
|
<application
|
||||||
android:label="todo"
|
android:label="todo"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
android:icon="@mipmap/ic_launcher">
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
|
android:dataExtractionRules="@xml/data_extraction_rules">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
|
|||||||
10
android/app/src/main/res/xml/backup_rules.xml
Normal file
10
android/app/src/main/res/xml/backup_rules.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Legacy Auto Backup rules (pre-Android 12 / API < 31). An empty
|
||||||
|
<full-backup-content> means "back up the default set" — the app's files dir
|
||||||
|
(the local CRDT DB todo.db), databases, and shared_prefs (sync settings +
|
||||||
|
token). See data_extraction_rules.xml for the rationale on backing up the
|
||||||
|
token for zero-touch recovery.
|
||||||
|
-->
|
||||||
|
<full-backup-content>
|
||||||
|
</full-backup-content>
|
||||||
18
android/app/src/main/res/xml/data_extraction_rules.xml
Normal file
18
android/app/src/main/res/xml/data_extraction_rules.xml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Android Auto Backup rules (API 31+ / Android 12+).
|
||||||
|
|
||||||
|
Empty <cloud-backup> and <device-transfer> elements mean "back up the default
|
||||||
|
set": the app's files dir (which holds the local CRDT DB, todo.db), the
|
||||||
|
databases dir, and shared_prefs (which holds the GitHub sync settings + token).
|
||||||
|
|
||||||
|
Backing up shared_prefs is intentional: it lets a reinstall restore the sync
|
||||||
|
configuration too, so recovery is zero-touch (no re-auth). The token is a
|
||||||
|
narrowly-scoped, contents-only PAT for the single private sync repo, stored in
|
||||||
|
the user's own Google backup. Auto-sync (the app's primary durability path)
|
||||||
|
still covers device loss; this is the secondary, OS-level safety net.
|
||||||
|
-->
|
||||||
|
<data-extraction-rules>
|
||||||
|
<cloud-backup />
|
||||||
|
<device-transfer />
|
||||||
|
</data-extraction-rules>
|
||||||
Loading…
Reference in New Issue
Block a user