예제 #1
0
  /**
   * Returns a crash-reporter-scoped SharedPreferences instance. You can disable migrations by using
   * the DISABLE_MIGRATIONS flag.
   */
  public static SharedPreferences forCrashReporter(Context context, EnumSet<Flags> flags) {
    if (flags != null && !flags.contains(Flags.DISABLE_MIGRATIONS)) {
      migrateIfNecessary(context);
    }

    return context.getSharedPreferences(CRASH_PREFS_NAME, 0);
  }
예제 #2
0
  /**
   * Returns an SharedPreferences instance scoped to the given profile name. You can disable
   * migrations by using the DISABLE_MIGRATION flag.
   */
  public static SharedPreferences forProfileName(
      Context context, String profileName, EnumSet<Flags> flags) {
    if (flags != null && !flags.contains(Flags.DISABLE_MIGRATIONS)) {
      migrateIfNecessary(context);
    }

    final String prefsName = PROFILE_PREFS_NAME_PREFIX + profileName;
    return context.getSharedPreferences(prefsName, 0);
  }