4

I have a app installed on my old phone with a lot of settings and data that I want to transfer to my new phone. So I tried using adb backup:

$ sudo adb backup -f org.secuso.privacyfriendlynotes.ab -apk
org.secuso.privacyfriendlynotes
WARNING: adb backup is deprecated and may be removed in a future release
Now unlock your device and confirm the backup operation...

Which worked fine:

$ ls -la
...
-rw-r-----.  1 root   root   5057212 Jul 16 10:59 org.secuso.privacyfriendlynotes.ab

But then to import the data on my new phone, I tried using adb restore:

sudo adb restore org.secuso.privacyfriendlynotes.ab
WARNING: adb restore is deprecated and may be removed in a future release
Now unlock your device and confirm the restore operation.

I unlocked and confirmed and the phone said "Restore starting..." and then "Restore ended", so everything seem fine. But the data was not restored.

Comparing /data/data/org.secuso.privacyfriendlynotes on both phones clearly shows that my data wasn't restored at all.

I realize that abd backup and adb restore are deprecated. What are the alternatives now? (I don't want to use Titanium Backup etc. I only use open source software.)

Is there an official alternative way to do this?

7
  • If you would remove -apk from command-line you can directly see on the file size of the created .ab file if the backup was successful. If the backup failed the file size will just be a few bytes.
    – Robert
    Jul 16, 2022 at 11:38
  • adb backup and restore of Secuso PF Notes works without problems on my devices. Just saved an image and restored it to a different device.
    – Robert
    Jul 16, 2022 at 11:43
  • It was around 5MB in size which seems fairly accurate. My old device was an Android 9 device and the new one runs Android 11. I suspect that it stopped working on Android 11. But I dont know. Which version of Android were you using?
    – Forivin
    Jul 16, 2022 at 12:44
  • I was using Android 11 and 12, both Google Pixel devices. Don't forget that the backup also includes the APK files with is about 3.7MB of size (at least the version I found on apkpure).
    – Robert
    Jul 16, 2022 at 17:28
  • Maybe a backup created on Android 9 can't be restored on Android 11.
    – Forivin
    Jul 16, 2022 at 18:21

1 Answer 1

1

The only workaround I could think of was a combination of adb pull, adb push, restorecon and chown:

APP_ID="org.secuso.privacyfriendlynotes"

# Backup (RUN WITH OLD PHONE CONNECTED)
adb pull "/data/data/${APP_ID}"

# Restore (RUN WITH NEW PHONE CONNECTED)
APP_OWNERSHIP=$(adb shell stat --format "%U:%G" "/data/data/${APP_ID}")
adb shell mv "/data/data/${APP_ID}" "/data/data/${APP_ID}_backup"
adb push "./${APP_ID}" "/data/data/${APP_ID}"
adb shell restorecon "/data/data/${APP_ID}"
adb shell chown -R "${APP_OWNERSHIP}" "/data/data/${APP_ID}"
#adb shell rm -rf "/data/data/${APP_ID}_backup"

It does require root though.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .