本文整理汇总了Java中android.app.backup.SharedPreferencesBackupHelper类的典型用法代码示例。如果您正苦于以下问题:Java SharedPreferencesBackupHelper类的具体用法?Java SharedPreferencesBackupHelper怎么用?Java SharedPreferencesBackupHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SharedPreferencesBackupHelper类属于android.app.backup包,在下文中一共展示了SharedPreferencesBackupHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.app.backup.SharedPreferencesBackupHelper; //导入依赖的package包/类
@Override
public void onCreate() {
Log.d("ConnectBot.BackupAgent", "onCreate called");
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferencesBackupHelper prefsHelper = new SharedPreferencesBackupHelper(this, getPackageName() + "_preferences");
addHelper(PreferenceConstants.BACKUP_PREF_KEY, prefsHelper);
FileBackupHelper hosts = new FileBackupHelper(this, "../databases/" + HostDatabase.DB_NAME);
addHelper(HostDatabase.DB_NAME, hosts);
if (prefs.getBoolean(PreferenceConstants.BACKUP_KEYS, PreferenceConstants.BACKUP_KEYS_DEFAULT)) {
FileBackupHelper pubkeys = new FileBackupHelper(this, "../databases/" + PubkeyDatabase.DB_NAME);
addHelper(PubkeyDatabase.DB_NAME, pubkeys);
}
}
示例2: onCreate
import android.app.backup.SharedPreferencesBackupHelper; //导入依赖的package包/类
@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);
}
示例3: onCreate
import android.app.backup.SharedPreferencesBackupHelper; //导入依赖的package包/类
@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();
}
示例4: onCreate
import android.app.backup.SharedPreferencesBackupHelper; //导入依赖的package包/类
@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);
}
示例5: onCreate
import android.app.backup.SharedPreferencesBackupHelper; //导入依赖的package包/类
@Override
public void onCreate()
{
// This is the preference name used by PreferenceManager.getDefaultSharedPreferences
String prefs = getPackageName() + "_preferences";
addHelper(BACKUP_KEY, new SharedPreferencesBackupHelper(this, prefs));
}
示例6: onCreate
import android.app.backup.SharedPreferencesBackupHelper; //导入依赖的package包/类
@Override
public void onCreate() {
// Compute the default preferences filename.
String defaultPrefsFilename = getPackageName() + "_preferences";
addHelper(PREFS_BACKUP_KEY,
new SharedPreferencesBackupHelper(this, defaultPrefsFilename));
}
示例7: onCreate
import android.app.backup.SharedPreferencesBackupHelper; //导入依赖的package包/类
@Override
public void onCreate() {
Log.d("ConnectBot.BackupAgent", "onCreate called");
SharedPreferencesBackupHelper prefs = new SharedPreferencesBackupHelper(this, getPackageName() + "_preferences");
addHelper(PreferenceConstants.BACKUP_PREF_KEY, prefs);
FileBackupHelper hosts = new FileBackupHelper(this, "../databases/" + HostDatabase.DB_NAME);
addHelper(HostDatabase.DB_NAME, hosts);
FileBackupHelper pubkeys = new FileBackupHelper(this, "../databases/" + PubkeyDatabase.DB_NAME);
addHelper(PubkeyDatabase.DB_NAME, pubkeys);
}
示例8: onCreate
import android.app.backup.SharedPreferencesBackupHelper; //导入依赖的package包/类
@Override
public void onCreate() {
FileBackupHelper helperFileBackupHelper = new FileBackupHelper(this, HIGH_SCORES_FILENAME);
addHelper(FILES_BACKUP_KEY, helperFileBackupHelper);
SharedPreferencesBackupHelper helperSharedPreferencesBackupHelper =
new SharedPreferencesBackupHelper(this, PREFS_DISPLAY, PREFS_SCORES);
addHelper(MY_PREFS_BACKUP_KEY, helperSharedPreferencesBackupHelper);
}
示例9: onCreate
import android.app.backup.SharedPreferencesBackupHelper; //导入依赖的package包/类
@Override
public void onCreate() {
// Hoo boy, there's a few prefs to back up...
SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(
this,
GHDConstants.PREF_AUTOZOOM,
GHDConstants.PREF_COORD_UNITS,
GHDConstants.PREF_DEFAULT_GRATICULE_GLOBALHASH,
GHDConstants.PREF_DEFAULT_GRATICULE_LATITUDE,
GHDConstants.PREF_DEFAULT_GRATICULE_LONGITUDE,
GHDConstants.PREF_DIST_UNITS,
GHDConstants.PREF_INFOBOX,
GHDConstants.PREF_KNOWN_LOCATIONS,
GHDConstants.PREF_LAST_MAP_TYPE,
GHDConstants.PREF_LAST_SEEN_VERSION,
GHDConstants.PREF_NEARBY_POINTS,
GHDConstants.PREF_SHOW_KNOWN_LOCATIONS,
GHDConstants.PREF_STARTUP_BEHAVIOR,
GHDConstants.PREF_STOCK_ALARM,
GHDConstants.PREF_STOCK_CACHE_SIZE,
GHDConstants.PREF_STOP_BUGGING_ME_PREFETCH_WARNING,
GHDConstants.PREF_WIKI_PASS,
GHDConstants.PREF_WIKI_USER,
GHDConstants.PREF_NIGHT_MODE
);
addHelper(PREFS_BACKUP_KEY, helper);
}
示例10: onCreate
import android.app.backup.SharedPreferencesBackupHelper; //导入依赖的package包/类
@SuppressLint("NewApi")
@Override
public void onCreate() {
super.onCreate();
String prefsName = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ? PreferenceManager.getDefaultSharedPreferencesName(
this) : getDefaultSharedPreferencesName(this);
SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(this, prefsName);
addHelper(PREFS_BACKUP_KEY, helper);
}
示例11: onCreate
import android.app.backup.SharedPreferencesBackupHelper; //导入依赖的package包/类
@Override
public void onCreate() {
// getDatabasePath(DB_NAME).getAbsolutePath()
FileBackupHelper dbs = new FileBackupHelper(this, DB_NAME);
SharedPreferencesBackupHelper helper =
new SharedPreferencesBackupHelper(this, getPackageName() + "_preferences");
addHelper("prefs", helper);
addHelper("dbs", dbs);
}
示例12: onCreate
import android.app.backup.SharedPreferencesBackupHelper; //导入依赖的package包/类
public void onCreate() {
Context app = getApplicationContext();
if (app instanceof DSCApplication) {
mApplication = (DSCApplication) app;
}
SharedPreferencesBackupHelper helper =
new SharedPreferencesBackupHelper(this, getDefaultSharedPreferencesName());
addHelper(MY_PREFS_BACKUP_KEY, helper);
}
示例13: onCreate
import android.app.backup.SharedPreferencesBackupHelper; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
// Back up all the preferences
SharedPreferencesBackupHelper prefHelper = new SharedPreferencesBackupHelper(this, PREF_DEF);
addHelper(KEY_PREF, prefHelper);
}
示例14: onCreate
import android.app.backup.SharedPreferencesBackupHelper; //导入依赖的package包/类
@Override
public void onCreate() {
Log.v(TAG, "onCreate called");
SharedPreferencesBackupHelper prefs = new SharedPreferencesBackupHelper(this, getPackageName() +
"_preferences");
addHelper(PreferenceConstants.BACKUP_PREF_KEY, prefs);
FileBackupHelper streams = new FileBackupHelper(this, "../databases/" + StreamDatabase.DATABASE_NAME);
addHelper(StreamDatabase.DATABASE_NAME, streams);
FileBackupHelper alarms = new FileBackupHelper(this, "../databases/" + DatabaseHelper.DATABASE_NAME);
addHelper(DatabaseHelper.DATABASE_NAME, alarms);
}
示例15: onCreate
import android.app.backup.SharedPreferencesBackupHelper; //导入依赖的package包/类
@Override
public void onCreate() {
SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(this, Constants.DEFAULT_PREFERENCES_FILE);
addHelper(PREFS_BACKUP_KEY, helper);
FileBackupHelper fileBackupHelper = new FileBackupHelper(this, Constants.REALM_FILE_NAME);
addHelper(FILES_BACKUP_KEY, fileBackupHelper);
}