0

I'm developing a program related to security in android studio. My problem is I want to make sure that the user has activated the backup feature from the Google account or no. I tried this code:(

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

0 Answers0