Note that there are some explanatory texts on larger screens.

plurals
  1. POBackupManager & BackupAgent in Android 2.2
    text
    copied!<p>I've reviewed the docs and the sample BackupRestore app and written my own test app implementing <code>android:backupAgent</code>. I extended the <code>BackupAgent</code> 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.</p> <p>To make things exceptionally simple, I declared the <code>android:backupAgent</code> as <code>MyBackupAgent</code> in the manifest. I then created a class MyBackupAgent.java, extending <code>BackupAgent</code>. I then created overrides for the <code>onBackup()</code> and <code>onRestore()</code> methods within the <code>MyBackupAgent</code> class, just like in the examples and docs. I added a <code>Log.i()</code> 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.</p> <p>I created an emulator image using 2.2w/Google API's and even added a gmail account under Accounts &amp; Sync. Running through the adb commands to enable <code>bmgr</code>, 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 <code>Log.i()</code> command in either of the <code>onBackup()</code> or <code>onRestore()</code> functions.</p> <p>I tried again on my Evo 4g running 2.2. Same result. It does not appear that the backup manager is calling the <code>onBackup()</code> and <code>onRestore()</code> functions in the <code>MyBackupAgent</code> class.</p> <p>The only odd message I get in my logs is one from the <code>BackupManagerService</code> stating "Backup pass but e=true p=false", I believe in response to the ADB command to backup the app.</p> <p>Any suggestions? Am I wrong to assume that a <code>Log.i()</code> statement in the <code>onBackup()</code> and <code>onRestore()</code> functions would show up in LogCat?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload