List of usage examples for android.preference PreferenceManager getDefaultSharedPreferences
public static SharedPreferences getDefaultSharedPreferences(Context context)
From source file:Main.java
public static boolean isLoggedIn(final Context context) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); return sp.getBoolean(PREF_LOGGED_IN, false); }
From source file:Main.java
public static boolean isTosAccepted(final Context context) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); return sp.getBoolean(PREF_TOS_ACCEPTED, false); }
From source file:Main.java
public static void setContentUuid(Context context, String contentUuid) { PreferenceManager.getDefaultSharedPreferences(context).edit().putString(CONTENT_UUID, contentUuid).apply(); }
From source file:Main.java
public static boolean isFirstLaunch(Context ctx) { return PreferenceManager.getDefaultSharedPreferences(ctx).getBoolean(APP_FIST_LAUNCH, true); }
From source file:Main.java
/** * Saves the sessionId./*from w w w . ja v a 2 s.c o m*/ */ public static void saveSessionId(Context context, String sessionId) { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); if (null == sessionId) { // we want to remove pref.edit().remove(PREF_SESSION_ID).apply(); } else { pref.edit().putString(PREF_SESSION_ID, sessionId).apply(); } }
From source file:Main.java
public static long getCurSyncInterval(final Context context) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); return sp.getLong(PREF_CUR_SYNC_INTERVAL, 0L); }
From source file:Main.java
/** * Returns the persisted session id.//from w w w . j a v a 2 s . c o m */ private static String getSessionIdFromPreference(Context context) { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); return pref.getString(PREF_SESSION_ID, null); }
From source file:Main.java
public static void removeKey(Context context, String key) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); sp.edit().remove(key).apply();//from w ww. j a v a 2s .co m }
From source file:Main.java
public static boolean hasDeclinedWifiSetup(Context context) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); return sp.getBoolean(PREF_DECLINED_WIFI_SETUP, false); }
From source file:Main.java
public static long getLastSyncSucceededTime(final Context context) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); return sp.getLong(PREF_LAST_SYNC_SUCCEEDED, 0L); }