问题
I've implemented backup/restore of SharedPreferences
using BackupManager
as per the Android docs, but I'm having trouble restoring preferences to a second device. I believe the implementation is fine, since I can restore settings to a single device, i.e. if I run the app, make changes, uninstall and reinstall I get the modified preferences that I expect. However, if I subsequently install the app on a second device, I don't see the changes, even if I use the bmgr tool
to force a backup on the first device and force a restore on the second device. Both devices have the same Google accounts, and both devices successfully restore their own backed up preferences on reinstall. I just can't get them to restore changes made from a different device.
If I install the app on a new device, I would expect it to restore the latest preferences, never mind from which device the backup was made. I've also set the android:restoreAnyVersion="true"
flag, but that made no difference. What am I missing? If the devices use different transport services, could that cause the problem I'm seeing?
来源:https://stackoverflow.com/questions/9932372/problems-restoring-to-multiple-devices-using-android-backupmanager