BackupManager Not Calling Backup Transport

北城以北 提交于 2019-11-28 18:45:40

1) Put Log.i() into your onCreate, to see if it's called.

2) Logcat indicates that your function didn't write anything. Check if you have shared_prefs/SCORES file in your app's private folder (assumes using appropriate file manager on rooted device). This is the file you're attempting to have in backup. Probably your preferences file is something else than this file, in such case fix your String SCORES to reflect real preferences file.

3) I tried to debug BackupAgentHelper.onCreate in my app, and it can be debugged after invoking adb shell bmgt... so it is possible to step here in debugger.

I had the same problem today with Android SDK 4.1. Using 2.3.3 versions, however, helped:

07-15 13:59:56.459: V/LocalTransport(61): performBackup() pkg=com........
07-15 13:59:56.469: V/LocalTransport(61): Got change set key=filehelper:../databases/database.db size=8208 key64=ZmlsZWhlbHBlcjouLi8kYXRhYmFzZXMvZXhwZW5zZXIuZGI=
07-15 13:59:56.469: V/LocalTransport(61):   data size 8208
07-15 13:59:56.469: V/LocalTransport(61): finishBackup()
Hayes Haugen

If you do not change your preferences data it will just back up once but not subsequently.

https://developer.android.com/reference/android/app/backup/SharedPreferencesBackupHelper.html

"Whenever a backup is performed, it will back up all named shared preferences that have changed since the last backup operation."

As other poster said make sure to have a log statement in your onCreate.

You can force a backup by:

// bmgr wipe TRANSPORT PACKAGE
bmgr wipe com.google.android.backup/.BackupTransportService com.kcoppock.sudoku

bmgr run

The default is com.google.android.backup/.BackupTransportService, but best to check for yourself with bmgr list transports.

You'll be much happier running against the local transport, not the default Google Transport. Check the dev docs on this.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!