Android备份管理器仅适用于本地传输

时间:2015-02-13 00:00:04

标签: android android-backup-service

我一直试图在我的应用上实施备份超过一个月,但直到现在都没有成功。 我已经完成了Google文档通知的每个步骤: 在Google服务上注册 清单上的更改(allowBackup,backupAgent和backup.api_key(谷歌服务注册)等等......

清单部分:

<application
   android:allowBackup="true"
   android:backupAgent="my.package.MyBackupManagerClass">

<meta-data android:name="com.google.android.backup.api_key" 
   android:value="my-generated-key-by-google-service" />

事实上,备份正在运行,但只使用本地传输,我已经使用bmgr备份/运行/恢复进行了测试:

bmgr list transports
  * android/com.android.internal.backup.LocalTransport
    com.google.android.gms/.backup.BackupTransportService

但是当尝试使用Google传输(云端:com.google.android.gms/.backup.BackupTransportService时,它无效,甚至无法从onCreate()拨打MyBackupAgentHelper

我要提到的一点是,当我跑步时: bmgr备份 bmgr run

运行命令之后,在logcat上显示了很多“现在暂存备份”(也显示我的应用程序包在此列表中)但是它发生得非常快,并且似乎事实上并没有完成备份所有,甚至我的MyBackupHelper.onCreate()都没有被调用:

02-12 21:13:28.889: D/BackupManagerService(547): Now staging backup of com.google.android.talk
02-12 21:13:28.904: D/BackupManagerService(547): Now staging backup of com.google.android.dialer
02-12 21:13:28.907: D/BackupManagerService(547): Now staging backup of com.android.providers.settings
02-12 21:13:28.910: D/BackupManagerService(547): Now staging backup of com.sirma.mobile.bible.android
02-12 21:13:28.914: D/BackupManagerService(547): Now staging backup of com.android.sharedstoragebackup
02-12 21:13:28.919: D/BackupManagerService(547): Now staging backup of com.google.android.gm
02-12 21:13:28.922: D/BackupManagerService(547): Now staging backup of com.android.providers.userdictionary
02-12 21:13:28.926: D/BackupManagerService(547): Now staging backup of com.google.android.apps.genie.geniewidget
02-12 21:13:28.963: I/GmsBackupTransport(1409): Next backup will happen in 86399923 millis.
02-12 21:13:28.967: I/BackupManagerService(547): Backup pass finished.

1 个答案:

答案 0 :(得分:0)

我有同样的情况 - 当我运行手动备份(通过adb shell命令)工作,但只使用本地传输。对我来说,解决方案是发布Google Play服务,因为我已经测试了数据备份服务而没有发布GP服务。如果您正在使用Proguard

,请检查您的proguard配置