BackupManager和放大器; BackupAgent中的Andr​​oid 2.2 [英] BackupManager & BackupAgent in Android 2.2

查看:103
本文介绍了BackupManager和放大器; BackupAgent中的Andr​​oid 2.2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我回顾了文档和示例Backu $ P $的PStore应用程序,并写了我自己的测试程序实施安卓backupAgent 。我延长了 BackupAgent 类,因为我主要关注的是能够从数据库备份的数据。我似乎无法甚至使概念验证的一个简单的应用程序使用此功能的工作。

I've reviewed the docs and the sample BackupRestore app and written my own test app implementing android:backupAgent. I extended the BackupAgent class because my main concern is being able to backup data from a database. I can't seem to even make a simple proof-of-concept app work with this feature.

为了使事情变得非常简单,我声明了安卓backupAgent MyBackupAgent 在清单中。然后,我创建了一个类MyBackupAgent.java,延长 BackupAgent 。然后,我创建的重写 onBackup() OnRestore中() MyBackupAgent <方法/ code>类,就像在实例和文档。我添加了一个 Log.i()调用每个函数的开始,这样我可以在LogCat中确定的时候,正在调用的函数。同样,我设置这两个断点。然后,我继续执行我的code备份数据库。

To make things exceptionally simple, I declared the android:backupAgent as MyBackupAgent in the manifest. I then created a class MyBackupAgent.java, extending BackupAgent. I then created overrides for the onBackup() and onRestore() methods within the MyBackupAgent class, just like in the examples and docs. I added a Log.i() call to the very beginning of each function so that I could identify within LogCat when the functions were being called. Likewise, I set breakpoints on both of these. I then went on to implement my code to backup the database.

我在使用2.2瓦特模拟器图像/谷歌的API,甚至在帐户与添加了Gmail帐户;同步。通过亚行的命令运行,使 BMGR ,备份应用程序,运行备份,卸载应用程序,重新安装应用程序等等....我从来没有一次得到了一个消息在任一日志从 Log.i()命令文件中的 onBackup() OnRestore中()功能。

I created an emulator image using 2.2w/Google API's and even added a gmail account under Accounts & Sync. Running through the adb commands to enable bmgr, backup the app, run the backup, uninstall the app, reinstall the app etc.... I never once get a message in the log file from the Log.i() command in either of the onBackup() or onRestore() functions.

我又试了我的EVO 4G运行2.2。同样的结果。它不会出现在备份管理器调用 onBackup() OnRestore中()功能在 MyBackupAgent 类。

I tried again on my Evo 4g running 2.2. Same result. It does not appear that the backup manager is calling the onBackup() and onRestore() functions in the MyBackupAgent class.

唯一奇怪的消息,我在我的记录是从 BackupManagerService 指出备份通,但E =真P =假,我相信,在应对亚洲开发银行命令备份应用程序。

The only odd message I get in my logs is one from the BackupManagerService stating "Backup pass but e=true p=false", I believe in response to the ADB command to backup the app.

有什么建议?我是一个错误的假设,在 onBackup() Log.i()语句> OnRestore中()的功能将出现在LogCat中?

Any suggestions? Am I wrong to assume that a Log.i() statement in the onBackup() and onRestore() functions would show up in LogCat?

推荐答案

检查手机的设置。如果同步化服务被禁用,然后通过数据备份API的备份将无法工作。

Check your phone's settings. If the syncronization-service is disabled then backup via Data Backup API won't work.

这篇关于BackupManager和放大器; BackupAgent中的Andr​​oid 2.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆