0

I have in my application Android manifest:

android:allowBackup="true"

But in spite of using an Android 8 device the backup does not work until I manually put in the console:

adb shell bmgr backup @pm@ && adb shell bmgr run

and...

adb shell bmgr fullbackup <PACKAGE>

as says the Android developers guide to test a backup.

I have tested so many devices and when I put this in console it starts to work fine and I can uninstall and install the application from Google Play without losing the SharedPreferences. But if I don't write this in my Android Studio console with the device connected, the backup doesn't work.

It's strange because many other applications restore their data, so I think that the device settings are ok and I am missing something in the code.

This are my build.gradle sdk specifications

def valueMinSdkVersion = 15
def valueTargetSdkVersion = 28

Thank you so much.

Mauricio Güell

1 Answer 1

3

use these 2 in your manifest:

android:allowBackup="true"

android:fullBackupOnly="true"

why we use fullBackuoOnly?

Android versions before Marshmallow had a backup system that required a significant developer effort to implement. If you implemented that system, but you want your app to use the new backup system on devices where it's available, you can set this flag to disable the old backup system only on devices where the new system is available. This is better than removing your implementation of the old backup system, because older devices will continue to back up with the old system. If you didn't implement the old backup system, or will remove it from your app, you don't need this flag.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for the answer, I have not implemented the old backup system!
If this is helpful for you, then kindly accept my answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.