Android Offline Backup

If you try to be offline as much as possible, backing up an Android phone before an upgrade or phone change is not quite as easy. As a start, try a non-Google Android contact/calendar sync. Then connect by USB and load stuff from the file system, and finally ask the apps for backup/restore functionality. For at least one app, you need the Android development program adb.

File System

From the file system starting at /sdcard, copy Books, DCIM, keepass, Kiwix (large, contains wikipedia), Music, noteeverything, OpenKeychain.

From /sdcard/Android/data, copy com.fsck.k9, de.hafas.android.db, de.schildbach.oeffi, de.softxperience.android.noteeverything, net.osmand.plus (large, contains maps), org.kiwix.kiwixmobile, org.thoughtcrime.securesms, uk.co.nickfines.RealCalcPlus, uk.co.olilan.touchcalendar.

After (re-)installing the apps, see which files you can overwrite.

Apps

For Signal, choose "Import/Export->Export plaintext backup", which gives a file /sdcard/SignalPlaintextBackup.xml. Restore with "Import plaintext backup".

For K-9 mail, go to accounts view (the first one; just do not be in "Unified Inbox" or in one of the accounts) and choose "Settings Import & Export->Export settings and accounts". This gives a file /sdcard/com.fsck.k9/settings.k9s. Restore with "Settings Import & Export->Import settings".

For OpenKeychain, choose "Top left->Backup/Restore->All keys + your own keys" and note the backup code, which you then enter to create /sdcard/backup_<date>.sec.pgp. Restore with "Backup/Restore->Select input file".

For Note Everything, choose "More->Export textnotes to SD-Card". This gives files text[1-99]_<notename>.txt in /sdcard/noteverything/text. Restore with "More->Import".

To see the Android files in the folder view of the PC, you need to reboot the phone, then reconnect.

For OSMAnd, choose "My Places->Share->e.g. K-9" to send a file favourites.gpx. Restore with a file explorer, clicking the gpx file should given an "Open with OSMAnd" choice. For the settings, adb backup -f osm.ab net.osmand.plus -apk, restore with adb restore osm.ab [forum].

APK Backup

Sometimes when you have a new phone, an app will have vanished from f-droid or gplay. Assuming compatibility to the new android version, and an adb connection you can download any installed apk package [forum] though it is a bit convoluted. First search for the internal app name (Java package name), here "music" since I wanted an older "music player" app.

adb shell pm list packages |grep music
    package:com.hmct.music
    package:com.maxfour.music
    package:com.android.einklauncher.plugin.musicplugin

Either by guessing or trying each, I found that com.maxfour.music is the one I want. Since the apk location is secret, we have to find out:

adb shell pm path com.maxfour.music
    package:/data/app/com.maxfour.music-miUMPl8eDqTvVOw-TRzmOQ==/base.apk

And finally we can download the package:

adb pull /data/app/com.maxfour.music-miUMPl8eDqTvVOw-TRzmOQ==/base.apk

The downloaded file name is always the same base.apk, so remember to rename the apk before starting the next download.

Conclusion

There, go ahead now, upgrade your phone. Good luck :)

EOF (Apr:2021)