android.app.backup.SharedPreferencesBackupHelper Java Examples

The following examples show how to use android.app.backup.SharedPreferencesBackupHelper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GoogleBackupAgent.java    From Clip-Stack with MIT License 6 votes vote down vote up
@Override
public void onCreate() {
    DbBackupHelper dataBaseBackupHelper =
            new DbBackupHelper(
                    this,
                    Storage.StorageHelper.DATABASE_NAME
            );
    SharedPreferencesBackupHelper mainSharedPreferencesBackupHelper =
            new SharedPreferencesBackupHelper(
                    this,
                    DEFAULT_PREFERENCE
                    );
    addHelper(BACKUP_PREFERENCE, mainSharedPreferencesBackupHelper);
    addHelper(BACKUP_DATABASE, dataBaseBackupHelper);
    super.onCreate();
}
 
Example #2
Source File: WorkTimeTrackerBackupAgentHelper.java    From trackworktime with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onCreate() {
	// The name of the SharedPreferences file
	final String prefs = getPackageName() + "_preferences"; // getPackageName() cannot be used in final
	SharedPreferencesBackupHelper prefsHelper = new SharedPreferencesBackupHelper(this, prefs) {
		@Override
		public void performBackup(ParcelFileDescriptor oldState, BackupDataOutput data,
			ParcelFileDescriptor newState) {
			if (new WorkTimeTrackerBackupManager(WorkTimeTrackerBackupAgentHelper.this).isEnabled()) {
				super.performBackup(oldState, data, newState);
			}
		}
	};
	addHelper(PREFS_BACKUP_KEY, prefsHelper);

	DbBackupHelper dbHelper = new DbBackupHelper(this);
	addHelper(DB_BACKUP_KEY, dbHelper);
}
 
Example #3
Source File: ShadowsocksBackupAgent.java    From ShadowsocksRR with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(this, PREFS_DISPLAY);
    addHelper(MY_PREFS_BACKUP_KEY, helper);
    addHelper(DATABASE, new FileBackupHelper(this, "../databases/" + DBHelper.PROFILE));
}
 
Example #4
Source File: BackupAgent.java    From BetterWeather with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    // Compute the default preferences filename.
    String defaultPrefsFilename = getPackageName() + "_preferences";
    addHelper(PREFS_BACKUP_KEY,
            new SharedPreferencesBackupHelper(this, defaultPrefsFilename));
}
 
Example #5
Source File: ShadowsocksBackupAgent.java    From Maying with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(this, PREFS_DISPLAY);
    addHelper(MY_PREFS_BACKUP_KEY, helper);
    addHelper(DATABASE, new FileBackupHelper(this, "../databases/" + DBHelper.PROFILE));
}
 
Example #6
Source File: BackupAgent.java    From andOTP with MIT License 5 votes vote down vote up
@Override
public void onCreate() {
    String prefs = getDefaultSharedPreferencesName();

    SharedPreferencesBackupHelper sharedPreferencesBackupHelper = new SharedPreferencesBackupHelper(this, prefs);
    addHelper(PREFS_BACKUP_KEY, sharedPreferencesBackupHelper);

    FileBackupHelper fileBackupHelper = new FileBackupHelper(this, Constants.FILENAME_DATABASE, Constants.FILENAME_DATABASE_BACKUP);
    addHelper(FILES_BACKUP_KEY, fileBackupHelper);
}
 
Example #7
Source File: SimpleBackupAgent.java    From science-journal with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
  Context context = getApplicationContext();
  String defaultPrefsName = getDefaultSharedPreferencesName(context);
  String[] accountsPrefsNames = AccountsUtils.getSharedPreferencesNamesForAllAccounts(context);
  SharedPreferencesBackupHelper helper =
      new SharedPreferencesBackupHelper(
          this, ObjectArrays.concat(defaultPrefsName, accountsPrefsNames));
  addHelper(PREFS_BACKUP_KEY, helper);
}
 
Example #8
Source File: OctoBackupAgent.java    From octoandroid with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCreate() {
    SharedPreferencesBackupHelper prefBackupHelper = new SharedPreferencesBackupHelper(this, DEFAULT_PREFS_FILENAME);
    addHelper(DEFAULT_PREFS_KEY, prefBackupHelper);

    // TODO not sure if need to implement synchronized since GreenDAO is thread safe...
    FileBackupHelper dbBackupHelper = new FileBackupHelper(this, StorageModule.DB_NAME);
    addHelper(PRINTER_DB_KEY, dbBackupHelper);
}
 
Example #9
Source File: SimpleBackupAgent.java    From android-device-identification with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate() {
    SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(this, PREFS);
    addHelper(PREFS_BACKUP_KEY, helper);
}
 
Example #10
Source File: MyBackupAgent.java    From codeexamples-android with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void onCreate() {
	SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(
			this, PREFS);
	addHelper(PREFS_BACKUP_KEY, helper);
}
 
Example #11
Source File: Backup.java    From Androzic with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onCreate()
{
	SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(this, PREFS);
	addHelper(PREFS_BACKUP_KEY, helper);
}
 
Example #12
Source File: MyBackupAgent.java    From ghwatch with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate() {
  SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(this, this.getPackageName() + "_preferences");
  addHelper(PREFS_BACKUP_KEY, helper);
  Log.d(TAG, "Backup manager created");
}
 
Example #13
Source File: BackupAgent.java    From Indic-Keyboard with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate() {
    addHelper("shared_pref", new SharedPreferencesBackupHelper(this,
            getPackageName() + PREF_SUFFIX));
}
 
Example #14
Source File: VolumeBackupAgent.java    From Noyze with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate() {
    addHelper(SharedPreferences.class.getSimpleName(),
            new SharedPreferencesBackupHelper(this, getPackageName() + "_preferences"));
}
 
Example #15
Source File: DataBackup.java    From Slide with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onCreate() {
    SharedPreferencesBackupHelper helper =
            new SharedPreferencesBackupHelper(this, PREFS_TO_BACKUP);
    addHelper(MY_PREFS_BACKUP_KEY, helper);
}
 
Example #16
Source File: SettingsBackupAgent.java    From Popeens-DSub with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onCreate() {
	super.onCreate();
	SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(this, Constants.PREFERENCES_FILE_NAME);
	addHelper("mypreferences", helper);
}
 
Example #17
Source File: TheBackupAgent.java    From chromadoze with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onCreate() {
    addHelper(PREF_BACKUP_KEY, new SharedPreferencesBackupHelper(
            this, ChromaDoze.PREF_NAME));
}
 
Example #18
Source File: MyBackupAgent.java    From kboard with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onCreate() {
    SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(this, PREFS);
    addHelper(PREFS_BACKUP_KEY, helper);
}
 
Example #19
Source File: VolumeBackupAgent.java    From Noyze with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate() {
    addHelper(SharedPreferences.class.getSimpleName(),
            new SharedPreferencesBackupHelper(this, getPackageName() + "_preferences"));
}
 
Example #20
Source File: BackupAgent.java    From shortyz with GNU General Public License v3.0 4 votes vote down vote up
public void onCreate() {
    SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(this, PREFS);
    addHelper(PREFS_BACKUP_KEY, helper);
}
 
Example #21
Source File: LatinIMEBackupAgent.java    From hackerskeyboard with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate() {
    addHelper("shared_pref", new SharedPreferencesBackupHelper(this,
            getPackageName() + "_preferences"));
}
 
Example #22
Source File: MyBackupAgent.java    From kboard with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onCreate() {
    SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(this, PREFS);
    addHelper(PREFS_BACKUP_KEY, helper);
}
 
Example #23
Source File: SettingsBackupAgent.java    From Audinaut with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(this, Constants.PREFERENCES_FILE_NAME);
    addHelper("mypreferences", helper);
}
 
Example #24
Source File: BackupAgent.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate() {
    addHelper("shared_pref", new SharedPreferencesBackupHelper(this,
            getPackageName() + PREF_SUFFIX));
}
 
Example #25
Source File: BackupAgent.java    From Android-Keyboard with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate() {
    addHelper("shared_pref", new SharedPreferencesBackupHelper(this,
            getPackageName() + PREF_SUFFIX));
}
 
Example #26
Source File: BackupAgent.java    From openboard with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onCreate() {
    addHelper("shared_pref", new SharedPreferencesBackupHelper(this,
            getPackageName() + PREF_SUFFIX));
}
 
Example #27
Source File: SharedPreferencesBackupHelper.java    From android_9.0.0_r45 with Apache License 2.0 3 votes vote down vote up
/**
 * Construct a helper for backing up and restoring the
 * {@link android.content.SharedPreferences} under the given names.
 *
 * @param context The application {@link android.content.Context}
 * @param prefGroups The names of each {@link android.content.SharedPreferences} file to
 * back up
 */
public SharedPreferencesBackupHelper(Context context, String... prefGroups) {
    super(context);

    mContext = context;
    mPrefGroups = prefGroups;
}