From f9794512b4032c2746e4500cea0efd62af9a128f Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Mon, 15 Jun 2026 22:04:59 +0200 Subject: [PATCH] Enable Android Auto Backup of the notes DB and sync settings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- android/app/src/main/AndroidManifest.xml | 5 ++++- android/app/src/main/res/xml/backup_rules.xml | 10 ++++++++++ .../src/main/res/xml/data_extraction_rules.xml | 18 ++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 android/app/src/main/res/xml/backup_rules.xml create mode 100644 android/app/src/main/res/xml/data_extraction_rules.xml diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index d31383a..ec4d8cd 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -6,7 +6,10 @@ + android:icon="@mipmap/ic_launcher" + android:allowBackup="true" + android:fullBackupContent="@xml/backup_rules" + android:dataExtractionRules="@xml/data_extraction_rules"> + + + diff --git a/android/app/src/main/res/xml/data_extraction_rules.xml b/android/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 0000000..2458ee6 --- /dev/null +++ b/android/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,18 @@ + + + + + +