0

I want to backup user data of my Android application. I want to store in Google cloud if user has turned on backup in Settings -> Google -> Backup, otherwise as a fallback push to our backend.

Questions:

1. Is it possible to find programatically if Google backup setting is turned on? If yes, which APIs to use?
2. If possible, how I can redirect user to System Settings to enable Google backup?

I have read the documentation about user data backup on android here but didn't find anything related to my problem.

EDIT
I have tried following code snippet to read Settings.BACKUP_ENABLED property as suggested here and here on my Android 13 Phone with Settings->Google->Backup turned ON, but the value of the property is always 0.

    try {
        int backups_enabled =  Settings.Secure.getInt(getApplicationContext().getContentResolver(), "backup_enabled");
        Log.i("TAG", "Backups are "+(backups_enabled == 1 ? "enabled" : "disabled"));
    } catch (Settings.SettingNotFoundException e) {
        Log.e("TAG", "Setting not found", e);
    }

Digging further in Android source code found that property backup_enabled is annotated as UnsupportedAppUsage so that might be the reason I get 0 even if setting is ON.

0 Answers0