I'm trying to get my app to auto-backup and restore its shared preferences as per the official docs. Both backup and restore work fine on an Android 6.0 device. However, although the backup works on pre-Android 6 devices, the restore fails. The precise error messages I see in logcat depend on the device being tested. Examples:
Samsung Galaxy S3 Mini, Android 4.1.2
07-02 11:05:00.240 2013-24968/? V/BackupManagerService: beginRestoreSession: pkg=com.my.app transport=null
07-02 11:05:00.260 2013-2024/? V/RestoreSession: restorePackage pkg=com.my.app obs=android.app.backup.IRestoreObserver$Stub$Proxy#42364000
07-02 11:05:00.260 2013-2119/? D/BackupManagerService: MSG_RUN_RESTORE observer=android.app.backup.IRestoreObserver$Stub$Proxy#42364000
07-02 11:05:01.340 2013-2119/? D/BackupManagerService: initiateOneRestore packageName=#pm#
07-02 11:05:01.420 2013-2119/? V/BackupServiceBinder: doRestore() invoked
07-02 11:05:01.500 2013-2119/? V/BackupManagerService: Package com.my.app restore version [24] is compatible with installed version [24]
07-02 11:05:01.530 2013-2119/? D/BackupManagerService: awaiting agent for ApplicationInfo{4240d338 com.my.app}
07-02 11:05:01.651 2013-2022/? D/BackupManagerService: agentConnected pkg=com.my.app agent=android.os.BinderProxy#424b9d48
07-02 11:05:01.651 2013-2119/? I/BackupManagerService: got agent android.app.IBackupAgent$Stub$Proxy#4274be90
07-02 11:05:01.651 2013-2119/? D/BackupManagerService: initiateOneRestore packageName=com.my.app
07-02 11:05:01.661 14846-14857/? V/BackupServiceBinder: doRestore() invoked
07-02 11:05:01.661 14846-14857/? W/BackupHelperDispatcher: Couldn't find helper for: 'prefs:VirtualSavingsPrefs'
07-02 11:05:01.661 14846-14857/? D/backup_data: Chunk header at 40 has invalid type: 0x6144bcbc
07-02 11:05:01.661 14846-14857/? D/BackupServiceBinder: onRestore (com.my.app.PreferencesBackupAgent) threw
java.io.IOException: failed: 0xffffffff
at android.app.backup.BackupDataInput.readNextHeader(BackupDataInput.java:112)
at android.app.backup.BackupHelperDispatcher.performRestore(BackupHelperDispatcher.java:111)
at android.app.backup.BackupAgentHelper.onRestore(BackupAgentHelper.java:75)
at android.app.backup.BackupAgent$BackupServiceBinder.doRestore(BackupAgent.java:527)
at android.app.IBackupAgent$Stub.onTransact(IBackupAgent.java:106)
at android.os.Binder.execTransact(Binder.java:367)
at dalvik.system.NativeStart.run(Native Method)
07-02 11:05:01.751 2013-2119/? V/BackupManagerService: No next package, finishing restore
Samsung Galaxy A3, Android 5.0.2
07-02 14:44:21.159 1002-1355/? V/BackupManagerService: beginRestoreSession: pkg=com.my.app transport=null
07-02 14:44:21.159 1002-4292/? V/RestoreSession: restorePackage pkg=com.my.app obs=android.app.backup.IRestoreObserver$Stub$Proxy#345efd33
07-02 14:44:21.159 1002-1128/? D/BackupManagerService: MSG_RUN_RESTORE observer=android.app.backup.IRestoreObserver$Stub$Proxy#345efd33
07-02 14:44:21.589 1529-1538/? I/GmsBackupTransport: Http Response Code : 200
07-02 14:44:21.619 1529-1872/? I/GmsBackupTransport: Current restore package : PackageInfo{207b91f #pm#}
07-02 14:44:21.619 1002-1128/? D/BackupManagerService: initiateOneRestore packageName=#pm#
07-02 14:44:21.649 1002-1128/? V/BackupServiceBinder: doRestore() invoked
07-02 14:44:21.659 1529-1871/? I/GmsBackupTransport: Current restore package : PackageInfo{4ab746c com.my.app}
07-02 14:44:21.659 1002-1128/? I/BackupManagerService: Next restore package: RestoreDescription{com.my.app : KEY_VALUE}
07-02 14:44:21.659 1002-1128/? V/BackupManagerService: Package com.my.app restore version [24] is compatible with installed version [24]
07-02 14:44:21.659 1002-1128/? D/BackupManagerService: awaiting agent for ApplicationInfo{2638d65b com.my.app}
07-02 14:44:21.659 1002-1014/? D/BackupManagerService: agentConnected pkg=com.my.app agent=android.os.BinderProxy#1551c6dd
07-02 14:44:21.659 1002-1128/? I/BackupManagerService: got agent android.app.IBackupAgent$Stub$Proxy#2a573252
07-02 14:44:21.659 1002-1128/? D/BackupManagerService: initiateOneRestore packageName=com.my.app
07-02 14:44:21.669 1002-1128/? E/BackupManagerService: SElinux restorecon failed for /cache/com.my.app.stage
07-02 14:44:21.669 17200-17214/? V/BackupServiceBinder: doRestore() invoked
07-02 14:44:21.669 17200-17214/? D/backup_data: SKIP_PADDING FAILED at line 334
07-02 14:44:21.669 1002-1128/? V/BackupManagerService: No more packages; finishing restore
07-02 14:44:21.699 1002-1128/? I/BackupRestoreController: restoreFinished for 0
07-02 14:44:21.699 1002-1128/? I/BackupManagerService: Restore complete.
07-02 14:44:21.699 1002-1128/? E/RestoreSession: Error in finishRestore
java.lang.NullPointerException: Attempt to read from field 'java.util.Set evs.d' on a null object reference
at android.os.Parcel.readException(Parcel.java:1546)
at android.os.Parcel.readException(Parcel.java:1493)
at com.android.internal.backup.IBackupTransport$Stub$Proxy.finishRestore(IBackupTransport.java:819)
at com.android.server.backup.BackupManagerService$ActiveRestoreSession$EndRestoreRunnable.run(BackupManagerService.java:9477)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.os.HandlerThread.run(HandlerThread.java:61)
07-02 14:44:21.699 1002-1128/? V/BackupManagerService: Clearing restore session and halting timeout
The log messages tagged with backup_data suggest some error occurs when trying to read in the backup data. Has anyone seen and know how to fix errors like this? I haven't been able to debug into the backup code to see what's going wrong.
I know the backup works because I can see a correctly timestamped backup entry for my app under each tested device under the Android section of https://www.google.com/settings/dashboard.
To support pre-Android 6 devices I extended BackupAgentHelper and added a SharedPreferencesBackupHelper in its onCreate() method as described here. The one thing different from the docs is that I had to precede the name of my backup agent helper class with a '.' in my manifest to avoid a class-not-found exception when loading the app. i.e.,:
android:backupAgent=".PreferencesBackupAgent"
Related
I am unable to run android's device ready function (not getting fired). How do I fix it? I have target sdk 22 and cordova 5.1.1 and android studio 1.0.1.
My index.html:
<!DOCTYPE html>
<html>
<head>
<title>Device Ready Example</title>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
</head>
<body onload="onLoad()">
</body>
</html>
index.js:
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
// device APIs are available
//
function onDeviceReady() {
window.addEventListener("batterystatus", onBatteryStatus, false);
}
// Handle the batterystatus event
//
function onBatteryStatus(info) {
console.log("Level: " + info.level + " isPlugged: " + info.isPlugged);
}
And where will this get logged : console.log("Level: " + info.level + " isPlugged: " + info.isPlugged);
If I run on command propmpt: cordova build:
Total time: 7.545 secs
C:\Users\salangar\hello\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "C:\Users\salangar\hello\platform
s\android\gradlew cdvBuildDebug -b C:\Users\salangar\hello\platforms\android\build.gradle -Dorg.gradle.daemon=true"
ERROR building one of the platforms: Error: cmd: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 1
at ChildProcess.whenDone (C:\Users\salangar\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:134:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
Logcat display:
I/WebViewFactory﹕ Loading com.android.webview version 39 (1737576-arm) (code 300001)
07-02 11:10:44.806 HelloWorld I/LibraryLoader﹕ Time to load native libraries: 726 ms (timestamps 7130-7856)
07-02 11:10:44.824 HelloWorld I/LibraryLoader﹕ Expected native library version number "",actual native library version number ""
07-02 11:10:44.979 HelloWorld V/WebViewChromiumFactoryProvider﹕ Binding Chromium to main looper Looper (main, tid 1) {951e68}
07-02 11:10:44.990 HelloWorld I/LibraryLoader﹕ Expected native library version number "",actual native library version number ""
07-02 11:10:45.113 HelloWorld I/BrowserStartupController﹕ Initializing chromium process, singleProcess=true
07-02 11:10:45.021 HelloWorld I/chromium﹕ [INFO:library_loader_hooks.cc(104)] Chromium logging enabled: level = 0, default verbosity = 0
07-02 11:10:45.140 HelloWorld W/art﹕ Attempt to remove local handle scope entry from IRT, ignoring
07-02 11:10:45.448 HelloWorld W/AudioManagerAndroid﹕ Requires BLUETOOTH permission
07-02 11:10:45.575 HelloWorld W/chromium﹕ [WARNING:resource_bundle.cc(304)] locale_file_path.empty()
07-02 11:10:45.590 HelloWorld I/chromium﹕ [INFO:aw_browser_main_parts.cc(65)] Load from apk succesful, fd=31 off=46184 len=3037
07-02 11:10:45.614 HelloWorld I/chromium﹕ [INFO:aw_browser_main_parts.cc(78)] Loading webviewchromium.pak from, fd:32 off:229484 len:1089587
07-02 11:10:45.828 HelloWorld E/chromium﹕ [ERROR:gl_surface_egl.cc(165)] No suitable EGL configs found.
07-02 11:10:45.829 HelloWorld E/chromium﹕ [ERROR:gl_surface_android.cc(23)] GLSurfaceEGL::InitializeOneOff failed.
07-02 11:10:45.835 HelloWorld E/chromium﹕ [ERROR:browser_main_loop.cc(988)] GLSurface::InitializeOneOff failed
07-02 11:10:46.790 HelloWorld W/chromium﹕ [WARNING:data_reduction_proxy_settings.cc(331)] SPDY proxy OFF at startup
07-02 11:10:47.032 HelloWorld W/art﹕ Attempt to remove local handle scope entry from IRT, ignoring
07-02 11:10:47.115 HelloWorld W/AwContents﹕ onDetachedFromWindow called when already detached. Ignoring
07-02 11:10:47.328 HelloWorld D/SystemWebViewEngine﹕ CordovaWebView is running on device made by: unknown
07-02 11:10:47.408 HelloWorld W/art﹕ Attempt to remove local handle scope entry from IRT, ignoring
07-02 11:10:47.408 HelloWorld W/art﹕ Attempt to remove local handle scope entry from IRT, ignoring
07-02 11:10:47.712 HelloWorld I/art﹕ Background sticky concurrent mark sweep GC freed 3517(255KB) AllocSpace objects, 2(32KB) LOS objects, 31% free, 764KB/1117KB, paused 2.313ms total 499.804ms
07-02 11:10:48.445 HelloWorld D/gralloc_goldfish﹕ Emulator without GPU emulation detected.
07-02 11:10:55.758 HelloWorld D/JsMessageQueue﹕ Set native->JS mode to OnlineEventsBridgeMode
07-02 11:10:56.152 HelloWorld I/art﹕ Background partial concurrent mark sweep GC freed 3730(208KB) AllocSpace objects, 1(16KB) LOS objects, 53% free, 887KB/1911KB, paused 1.825ms total 326.232ms
07-02 11:10:57.749 HelloWorld I/Choreographer﹕ Skipped 45 frames! The application may be doing too much work on its main thread.
07-02 11:11:00.752 HelloWorld I/Choreographer﹕ Skipped 54 frames! The application may be doing too much work on its main thread.
07-02 11:11:01.075 HelloWorld I/Choreographer﹕ Skipped 31 frames! The application may be doing too much work on its main thread.
07-02 11:11:01.545 HelloWorld I/chromium﹕ [INFO:CONSOLE(1188)] "deviceready has not fired after 5 seconds.", source: file:///android_asset/www/cordova.js (1188)
07-02 11:11:01.750 HelloWorld I/chromium﹕ [INFO:CONSOLE(1181)] "Channel not fired: onPluginsReady", source: file:///android_asset/www/cordova.js (1181)
07-02 11:11:01.752 HelloWorld I/chromium﹕ [INFO:CONSOLE(1181)] "Channel not fired: onCordovaReady", source: file:///android_asset/www/cordova.js (1181)
07-02 11:11:03.655 HelloWorld W/PluginManager﹕ THREAD WARNING: exec() call to CoreAndroid.show blocked the main thread for 161ms. Plugin should use CordovaInterface.getThreadPool().
07-02 11:11:04.699 HelloWorld I/chromium﹕ [INFO:CONSOLE(47)] "Received Event: deviceready", source: file:///android_asset/www/js/index.js (47)
07-02 11:11:27.708 HelloWorld I/Choreographer﹕ Skipped 33 frames! The application may be doing too much work on its main thread.
07-02 11:11:28.112 HelloWorld I/Choreographer﹕ Skipped 34 frames! The application may be doing too much work on its main thread.
07-02 11:11:58.646 HelloWorld I/Choreographer﹕ Skipped 33 frames! The application may be doing too much work on its main thread.
device ready function (not getting fired). How do I fix it?
You don't need to use onLoad() function to call deviceready event.
instead of this :-
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
just write :-
document.addEventListener("deviceready", onDeviceReady, false);
and another thing is you need to write the script cordova.js part inside the body tag and add the index.js file like the cordova.js.
where will this get logged : console.log("Level: " + info.level + " isPlugged: " + info.isPlugged);
This log is print in logcat.
Hope this help :) if you have any difficulties please let me know.
The Facebook app (and Messenger) app crashes on Android Genymotion Emulator on OS X v10.10.3. Other apps that I have installed till now, run flawlessly without any error. Here is the logcat generated when the app starts (& crashes),
03-14 21:20:25.351 516-721/system_process I/ActivityManager﹕ START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=com.facebook.katana cmp=com.facebook.katana/.LoginActivity} from pid 1752
03-14 21:20:25.591 516-674/system_process I/ActivityManager﹕ Start proc com.facebook.katana:nodex for activity com.facebook.katana/.LoginActivity: pid=3031 uid=10078 gids={50078, 1028, 1015, 3003}
03-14 21:20:25.647 3031-3031/? E/dalvikvm﹕ Could not find class 'com.facebook.katana.app.WallpaperFacebookApplicationImpl', referenced from method com.facebook.katana.app.FacebookApplication.a
03-14 21:20:25.659 3031-3031/? D/CatchMeIfYouCan﹕ Process (nodex) ca: '/data/data/com.facebook.katana/app_cmiyc/902B45094161489D3AB6470A02B22D0D4A228C3001'
03-14 21:20:25.659 3031-3031/? D/CatchMeIfYouCan﹕ Process (nodex) fc: '/data/data/com.facebook.katana/app_cmiyc/902B45094161489D3AB6470A02B22D0D4A228C3002'
03-14 21:20:25.659 3031-3031/? D/ACRA﹕ ACRA is enabled for com.facebook.katana, intializing...
03-14 21:20:25.663 3031-3031/? D/ACRA﹕ Looking for error files in /data/data/com.facebook.katana/app_acra-reports
03-14 21:20:25.663 3031-3031/? D/ACRA﹕ Looking for error files in /data/data/com.facebook.katana/app_minidumps
03-14 21:20:25.667 3031-3031/? D/dalvikvm﹕ Trying to load lib /data/app-lib/com.facebook.katana-2/libgnustl_shared.so 0xa50c1508
03-14 21:20:25.807 144-144/? I/DEBUG﹕ pid: 3031, tid: 3031, name: ok.katana:nodex >>> com.facebook.katana:nodex <<<
03-14 21:20:26.075 516-3049/system_process W/ActivityManager﹕ Force finishing activity com.facebook.katana/.LoginActivity
03-14 21:20:26.611 516-726/system_process I/ActivityManager﹕ Process com.facebook.katana:nodex (pid 3031) has died.
The specific error is,
21:20:25.647 3031-3031/? E/dalvikvm﹕ Could not find class 'com.facebook.katana.app.WallpaperFacebookApplicationImpl', referenced from method com.facebook.katana.app.FacebookApplication.a
Has anybody fixed the problem?
As far right now, I am using the Google 4.3 in the Virtual Machine, and Facebook app (& messenger) work fine. I will wait the bug to be fixed.
I successfully completed the Paypal sandbox account testing. But when I came into production environment it always shows the error:'TRANSACTION REFUSED'. Can anyone please tell me why its happening?
What is App redirect URLs and return URL? Is it necessary to give both while creating an app in developer.paypal.com?
here is what my Logcat shows:
07-02 14:34:37.382: E/n(274): com.paypal.android.p2pmobile not found.
07-02 14:34:37.732: D/dalvikvm(274): GC_EXTERNAL_ALLOC freed 9617 objects / 730512 bytes in 117ms
07-02 14:34:40.493: W/KeyCharacterMap(274): No keyboard for id 0
07-02 14:34:40.493: W/KeyCharacterMap(274): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
07-02 14:34:42.132: D/NativeCrypto(274): Freeing OpenSSL session
07-02 14:34:45.221: D/NativeCrypto(274): Freeing OpenSSL session
07-02 14:34:45.221: D/NativeCrypto(274): Freeing OpenSSL session
07-02 14:34:45.231: D/dalvikvm(274): GC_FOR_MALLOC freed 9678 objects / 719704 bytes in 212ms
07-02 14:35:01.942: W/paypal.sdk(274): W SN:16 PayPal Debug-ID: c071e094f8f48 [live, 2.2.2;release]
07-02 14:35:05.161: W/paypal.sdk(274): Y SN:19 PayPal Debug-ID: 70dc1489f9faa [live, 2.2.2;release]
07-02 14:35:05.171: E/paypal.sdk(274): request failure with http statusCode:400,exception:org.apache.http.client.HttpResponseException: Bad Request
07-02 14:35:05.171: E/paypal.sdk(274): request failed with server response:{"name":"TRANSACTION_REFUSED","message":"The request was refused.{0}","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#TRANSACTION_REFUSED","debug_id":"70dc1489f9faa"}
07-02 14:35:05.171: E/PayPalService(274): TRANSACTION_REFUSED
I looked into the PayPal Debug-ID that you provided - the error indicates that the payer account may not be associated with a usable funding source. Can you check the payer account you are using?
I got the sample for Restore/backup by android sdk samples, and its working fine, but updating only 1st version of data. So when i install to a device, modifying some data, after all the time when i uninstall/then re will be restored only that 1 version when i installed 1st the app whit that modification.
I think data after the 1st update to the cloud will never more change.
Here is my log for :
1- installing apk
2- changing the data state.
3- uninstalling the apk
4- reinstall
5- the 1st restored that will be restoring
V/BackupManagerService(192): restoreAtInstall pkg=com.lynx.backup token=10
D/BackupManagerService(192): MSG_RUN_RESTORE observer=null
D/BackupManagerService(192): initiateOneRestore packageName=#pm#
V/BackupServiceBinder(192): doRestore() invoked
V/BackupManagerService(192): Package com.lynx.backup restore version [1] is compatible with installed version [2]
D/BackupManagerService(192): awaiting agent for ApplicationInfo{40f5f440 com.lynx.backup}
V/BackupServiceBinder(31754): doRestore() invoked
I/Backup time(31754): ..in loop..
D/BackupManagerService(192): agentConnected pkg=com.lynx.backup agent=android.os.BinderProxy#4136a118
D/BackupManagerService(192): initiateOneRestore packageName=com.lynx.backup
V/BackupManagerService(192): No next package, finishing restore
I/BackupManagerService(192): Restore complete.
D/BackupManagerService(192): Received broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.lynx.backup flg=0x10000010 (has extras) }
V/BackupManagerService(192): addPackageParticipantsLocked: #1
V/BRActivity(31754): datafile exists
V/BRActivity(31754): mayo=true tomato=true filling=2130968577
V/PhoneStatusBar(259): setLightsOn(true)
V/BRActivity(31754): New radio item selected: 2130968579
V/BRActivity(31754): NEW STATE: mayo=true tomato=true filling=2130968579
V/BRActivity(31754): Checkbox toggled: android.widget.CheckBox#40eff6a8
V/BRActivity(31754): NEW STATE: mayo=false tomato=true filling=2130968579
D/LocalBluetoothProfileManager(32014): LocalBluetoothProfileManager construction complete
E/BinaryDictionaryGetter(352): Could not find a dictionary pack
D/BackupManagerService(192): Received broadcast Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.lynx.backup flg=0x10000010 (has extras) }
V/BackupManagerService(192): removePackageParticipantsLocked: #1
D/LocalBluetoothProfileManager(32169): LocalBluetoothProfileManager construction complete
V/BackupManagerService(192): restoreAtInstall pkg=com.lynx.backup token=11
D/BackupManagerService(192): MSG_RUN_RESTORE observer=null
D/BackupManagerService(192): initiateOneRestore packageName=#pm#
V/BackupServiceBinder(192): doRestore() invoked
V/BackupManagerService(192): Package com.lynx.backup restore version [1] is compatible with installed version [2]
D/BackupManagerService(192): awaiting agent for ApplicationInfo{412aff08 com.lynx.backup}
D/BackupManagerService(192): agentConnected pkg=com.lynx.backup agent=android.os.BinderProxy#416c6f30
D/BackupManagerService(192): initiateOneRestore packageName=com.lynx.backup
V/BackupServiceBinder(32290): doRestore() invoked
I/Backup time(32290): ..in loop..
V/BackupManagerService(192): No next package, finishing restore
I/BackupManagerService(192): Restore complete.
D/BackupManagerService(192): Received broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.lynx.backup flg=0x10000010 (has extras) }
V/BackupManagerService(192): addPackageParticipantsLocked: #1
V/BRActivity(32407): datafile exists
V/BRActivity(32407): mayo=true tomato=true filling=2130968577
V/PhoneStatusBar(259): setLightsOn(true)
D/BackupManagerService(192): couldn't find params for token 0
There are some data in my Android app that I would like to backup and restore. For that purpose I have created a custom implementation of BackupAgent.
In my manifest in have included the backup agent as you can see below
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto"
package="com.myapp"
android:versionCode="14"
android:versionName="1.13" >
<application
android:backupAgent="com.myapp.MyBackupAgent">
<meta-data
android:name="com.google.android.backup.api_key"
android:value="my key" />
I have included the backup service api key, although I am testing with the emulator (Android 2.2) and it should not be necessary, because it uses the local backup transport.
In order to do the test of the backup and restore I have done the following:
Start the emulator with my application installed.
Enable backup
adb shell bmgr enable true
Call the part of my code were the dataChanged method in the BackupManager class is called.
Initiate manually the backup operation
adb shell bmgr run
Checked in the log that the onBackup method of my custom BackupAgent was called.
Uninstall the app
Reinstall the app
Check in the log if the onRestore method is called.
The thing is that the onRestore method does not seem to be called and I don't know why. After reinstalling the app or manually triggering the restore with adb I see the following in the console.
$adb shell bmgr restore com.myapp
restoreStarting: 2 packages
restoreFinished: 0
done
and this other in the log
D/AndroidRuntime( 8259):
D/AndroidRuntime( 8259): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 8259): CheckJNI is ON
D/AndroidRuntime( 8259): --- registering native functions ---
D/BackupManagerService( 59): MSG_RUN_RESTORE observer=android.app.backup.IRestoreObserver$Stub$Proxy#450e16a8
V/LocalTransport( 59): start restore 1
V/LocalTransport( 59): nextRestorePackage() = #pm#
V/LocalTransport( 59): getRestoreData() found 7 key files
V/LocalTransport( 59): ... key=com.android.providers.settings size=1208
V/LocalTransport( 59): ... key=com.myapp size=501
V/LocalTransport( 59): ... key=android size=1208
V/LocalTransport( 59): ... key=com.android.providers.userdictionary size=1208
V/LocalTransport( 59): ... key=com.android.browser size=1208
V/LocalTransport( 59): ... key=com.android.inputmethod.latin size=1208
V/LocalTransport( 59): ... key=#meta# size=11
V/LocalTransport( 59): no more packages to restore
V/LocalTransport( 59): finishRestore()
V/LocalTransport( 59): finishRestore()
D/AndroidRuntime( 8259): Shutting down VM
but I don't see that the call to onRestore is actually made (I have some logging statements just at the beginning of it?
Has this ever happen to you? Is there any reason by the onRestore method is not called, even in the onBackup was called?
In my experience, for some odd reason (which I have yet to identify), logging statements made in BackupAgents don't show up in the logs. Nonetheless, I have been able to confirm that the onRestore method is in fact properly run.
In your question you indicate that the onRestore method "does not seem to be called" because you are unable to see the proper logs. Can you instead confirm that the result is failing (i.e. that data that should be properly restored isn't)?
I had this problem and the root cause was that I had a bug in my onBackup preventing it from completing, so onBackup was called but onRestore was not. Fixing the exception in onBackup caused onRestore to be called.
Also Log messages in onBackup and onRestore do show up in the logs. If you set a log filter on the tag "backup" and use something with backup in it for your log tag. You will see logging from the system and yours. Here is what I get
09-08 17:06:56.581 294-352/system_process V/BackupServiceBinder﹕ doBackup() invoked
09-08 17:06:56.591 294-352/system_process D/PerformBackupTask﹕ starting agent for backup of BackupRequest{pkg=android}
09-08 17:06:56.591 294-352/system_process D/BackupManagerService﹕ awaiting agent for ApplicationInfo{40d5efc0 android}
09-08 17:06:56.591 294-308/system_process D/BackupManagerService﹕ agentConnected pkg=android agent=android.app.backup.BackupAgent$BackupServiceBinder#4112a228
09-08 17:06:56.601 294-352/system_process V/BackupServiceBinder﹕ doBackup() invoked
09-08 17:06:56.601 294-352/system_process D/BackupHelperDispatcher﹕ handling existing helper 'wallpaper' android.app.backup.WallpaperBackupHelper#41149150
09-08 17:06:56.621 294-352/system_process D/PerformBackupTask﹕ starting agent for backup of BackupRequest{pkg=com.catglo.sellpr}
09-08 17:06:56.661 294-352/system_process D/BackupManagerService﹕ awaiting agent for ApplicationInfo{41074748 com.catglo.sellpr}
09-08 17:06:56.781 294-514/system_process D/BackupManagerService﹕ agentConnected pkg=com.catglo.sellpr agent=android.os.BinderProxy#410768c8
09-08 17:06:56.791 2263-2274/com.catglo.sellpr V/BackupServiceBinder﹕ doBackup() invoked
09-08 17:06:56.791 2263-2274/com.catglo.sellpr I/backup﹕ onBackup called
09-08 17:06:57.251 294-352/system_process I/PerformBackupTask﹕ Backup pass finished.
in the above log com.catglo.sellpr is from my app and the line that reads com.catglo.sellpr I/backup﹕ onBackup called is the log message in my code. For the onRestore I get
09-08 17:13:34.431 294-352/system_process D/BackupManagerService﹕ MSG_RUN_RESTORE observer=android.app.backup.IRestoreObserver$Stub$Proxy#413132c0
09-08 17:13:34.511 294-352/system_process V/BackupServiceBinder﹕ doRestore() invoked
09-08 17:13:34.561 294-352/system_process D/BackupManagerService﹕ awaiting agent for ApplicationInfo{41074748 com.catglo.sellpr}
09-08 17:13:34.561 294-427/system_process D/BackupManagerService﹕ agentConnected pkg=com.catglo.sellpr agent=android.os.BinderProxy#41127ee0
09-08 17:13:34.571 2263-2276/com.catglo.sellpr V/BackupServiceBinder﹕ doRestore() invoked
09-08 17:13:34.571 2263-2276/com.catglo.sellpr I/backup﹕ onRestore called
Earlier I had an exception in onBackup and my log from onRestore was never called but the system messages related to restore were.
The app will not Force Close because of an exception in the backup.