BackupAgent.onRestore not called when re-install app BUT called for bmgr restore command
Asked Answered
D

1

8

I am testing my custom BackupAgent. The below is my test in Simulator & Eclipse ADT

Test 1 backup & restore using command ---- WORK WELL

  1. adb shell bmgr enabled
  2. adb shell bmgr backup app_package
  3. adb shell bmgr run ---------------------- Run backup (BackupAgent.onBackup called)
  4. On the app, I deleted some data
  5. adb shell bmgr restore app_package ------- Restore data from backup
  6. All is restored including some data I deleted on step 4 ------ WORK WELL

Test 2 Backup / uninstall app / re-install app ---- NOT WORK

  1. adb shell bmgr enabled
  2. adb shell bmgr backup app_package
  3. adb shell bmgr run ----------------------Run backup (BackupAgent.onBackup called)
  4. adb uninstall app_package --------------- Uninstall the app after backup
  5. Debug As / Android Application again ---- Application re-installed BUT NO data is restored ( data backup at step 3)

Updated

  • I found Test 2 worked on Nexus 5 Simulator (API 19 - 4.4.2)
  • BUT Test 2 didn't work on Nexus 4 Simulator (API 16-4.1.2)

Anyone has any ideas? Thank you!

Depend answered 3/4, 2015 at 14:57 Comment(0)
M
1

very late, but have you tried setting the transport service to local?

adb shell bmgr list transports

prints

android/com.android.internal.backup.LocalTransport
* com.google.android.gms/.backup.BackupTransportService

change it to the local one

adb shell bmgr transport android/com.android.internal.backup.LocalTransport

Malayopolynesian answered 14/6, 2017 at 8:24 Comment(1)
LocalTransport won't work across devices because it won't store the data in the google drive.Disbranch

© 2022 - 2024 — McMap. All rights reserved.