6

I've purchased a new phone and have transferred most of the data from the old device to the new one using various means.

There is one app, however, that does not have account login, so I cannot save cached data in the cloud. Meaning that I have no choice but to move/restore the app to the new device with the offline (cached) data.

This app is quite important to me, and I need the offline data.

I know of the following techniques to do this:

  • Backup and restore app + cached data using Helium: copy & replace the 'sdcard/carbon' folder from the old phone to the new phone. After doing this, restore the app with data on the new phone.
  • Root the device and use Titanium backup to do the same.
  • Backup apps using the 'Backup' feature in Google Drive.

Helium just did not work (with a brand new phone with Android 8.0!).

I cannot use Titanium as I cannot root my old phone at this point (before backup is complete). And restoring the app this way will in all likelihood require that I root my new phone as well, which is a deal-breaker.

Does Google Drive Backup work with all third party apps? I did not see the app I want to save in the list of apps whose data was being saved by Google Drive.

What should I do? Can anyone advise?

EDIT:

All of the techniques given on various sites for both partial and full backups (including nandroid backups) are device specific, i.e. you can restore to the same device only, not from one device to another. This includes both Droid Explorer and Simple ADB Backup too, apparently.

Is there no general way of restoring an app with data to a new phone without root? Google Drive backup does this without root. If it can do that, why can't other apps?

Also, various people suggested using MyBackup Pro / Android Assistant / DrFone+. All these tools give up before even trying: they all seem to require root.

Y.S.
  • 361
  • 3
  • 6
  • 12
  • adb backup is pretty general because it stores data in a way which allows restoring to any device. if the app is not allowing adb backup, you still can extract the app from any other backup and convert to adb backup. check if stock recovery has backup option – alecxs Apr 29 '19 at 15:11
  • @alecxs: "if the app is not allowing adb backup, you still can extract the app from any other backup and convert to adb backup. check if stock recovery has backup option" please explain what you mean by this :) – Y.S. Apr 29 '19 at 18:24
  • some stock recovery have backup option http://www.patchworkoftips.com/backup-restore-data-stock-android-system-recovery/5904 – alecxs Apr 29 '19 at 20:13
  • @alecxs: LG Nexus 5. Carrier unlocked but not rooted. – Y.S. Apr 30 '19 at 12:07
  • twrp is available for hammerhead. but bootloader is locked. you can not boot twrp from fastboot :( – alecxs Apr 30 '19 at 12:31
  • @alecxs: so, first unlock bootlader and root, right? – Y.S. Apr 30 '19 at 17:23
  • Nope! Unfortunately you cannot unlock without data loss – alecxs Apr 30 '19 at 18:08
  • @alecxs: right, yeah, it will wipe the device – Y.S. May 01 '19 at 07:46
  • There is maybe a exploit which allows rooting without custom recovery. Some chinese apps will do that! https://pastebin.com/pN7jnBTc – alecxs May 01 '19 at 10:16
  • you can install TWRP with locked bootloader - install TWRP app https://play.google.com/store/apps/details?id=me.twrp.twrpapp - root the source phone with KingRoot https://forum.xda-developers.com/showthread.php?t=3159986 - backup your stock recovery and flash twrp recovery from TWRP app - boot into recovery and create a backup of data - replace base.apk in /data/app/ with your modified version (allowBackup in manifest) - wipe dalvik cache - reboot system - create adb backup - install modified apk to destination phone - restore adb backup – alecxs May 02 '19 at 15:43
  • @alecxs: thanks brah, am trying out all these various suggestions of yours. Wish Helium worked. Actually I should be able to get the offline data with adb backup command, but since this app is not showing up in Google Drive's list of backed up apps, I'm guessing it's either not targeting API 23 or auto-backup has been disabled .... :( – Y.S. May 02 '19 at 15:48
  • @alecxs: if possible, could you edit your answer with all these approaches that you've suggested? It would be very helpful to others too .... :) – Y.S. May 02 '19 at 15:51
  • it's not really targeting question - without ROOT - and it is very device specific (exploit, twrp) ... – alecxs May 03 '19 at 09:33

1 Answers1

4

You can use adb backup. You can specify the package name for backup a single app (for comprehensive details refer to Nikolay Elenkov)

adb backup [-f <file>] [-apk|-noapk] [-obb|-noobb] [-shared|-noshared] [-all] [-system|nosystem] [-keyvalue|-nokeyvalue] [<packages...>]
adb restore <file>

Note: some apps won't allow adb backup. even if adb backup is allowed, cache is not included.

Find a [GUIDE] How to enable adb backup for any app, decompile, recompile and sign the apk, where you have set the following flags:

android:allowBackup="true"
android:fullBackupOnly="false"

On the source phone, update the apk with your modified one. To do this without uninstalling, this may require to increment the android:versionCode in AndroidManifest.xml, and you must sign the apk using the same original signature that was used previously for the apk from the Play Store. This is the pitfall if you are not the author of the app it is not possible. However, if you manage this the install will succeed without data loss. Otherwise install will be rejected. (You still have the option to set allowBackup directly on rooted phone, but this may be out of scope because with root you can backup app directly) apparently there is no way to override AndroidManifest.xml during runtime

Once you have installed the modified apk you can make a backup of your app from source phone, and restore it to destination phone without root.

Install the latest Platform Tools and run from cmd.exe as Administrator:

adb.exe backup "-f C:\example.ab -apk -obb com.example.package"

edit:

  • be aware you have compiled a different app that can't be updated via PlayStore anymore

  • starting with api level 30 modified apk is no longer required as the flag seems ignored
    xda-developers.com

  • starting with api level 31 the flag is different

    android:debuggable="true"
    
alecxs
  • 4,034
  • 3
  • 16
  • 34
  • someone claims he was able to get a full backup with HDDRawCopy and QPST without root https://forum.xda-developers.com/showthread.php?t=3570178 Once you have it, extract app data from backup and create your own backup.ab including cache for injection (new question) – alecxs Apr 30 '19 at 13:01
  • 1
    adb uninstall -k <pkgname> will keep the app data, adb install -r example.apk will force the reinstall. not sure if this works with different signatures – alecxs Jul 24 '19 at 18:36
  • If you modify the apk file the app is no longer genuine, hence it is a different app that can't be updated via PlayStore. And if you uninstall the modified apk and install the latest from PlayStore you los all your data. Therefore In my opinion you just have to accept the truth: If the app denies backup you can't restore it via adb backup on an unrooted device. – Robert Nov 06 '20 at 08:15
  • @Robert thx for testing, never tried. thought when uninstalling with -k only the pkgname is left – alecxs Nov 06 '20 at 08:45
  • 1
    @alecxs If this would work it would a security problem as it would allow you to read out private app data. If you try to do so adb install -r ... gives you the following error [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package <app> signatures do not match the previously installed version; ignoring!] – Robert Nov 06 '20 at 09:38
  • 1
    @alecxs I found the changes in the official documentation however it only speaks about device-to-device migration, not adb backup. I don't know how exactly the device-to-device backup works but it seems to be different to adb backup as I don't manage to backup app data with targetSDK=30 and backup disallowed. – Robert Jan 31 '22 at 10:03
  • 1
    @Robert found another doc https://developer.android.com/about/versions/12/behavior-changes-12#adb-backup-restrictions – alecxs Apr 15 '22 at 17:10
  • 1
    A good finding. That would mean effectively adb backup is dead since Android 12, for all apps that target API 31+ (e.g. all apps from Play Store) even if they declare allowBackup="true". A quick test on my Android 12 device seems to confirm this. Seems like this is the way Google put adb backup EOL (it was already deprecated for several years). – Robert Apr 15 '22 at 17:37