Example usage for android.preference PreferenceManager getDefaultSharedPreferences

List of usage examples for android.preference PreferenceManager getDefaultSharedPreferences

Introduction

In this page you can find the example usage for android.preference PreferenceManager getDefaultSharedPreferences.

Prototype

public static SharedPreferences getDefaultSharedPreferences(Context context) 

Source Link

Document

Gets a SharedPreferences instance that points to the default file that is used by the preference framework in the given context.

Usage

From source file:Main.java

/**
 * Retrieve if geofencing triggers should show a notification from app preferences.
 *//*from   www  . ja v  a 2 s . com*/
public static boolean getGeofenceEnabled(Context context) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    return prefs.getBoolean(PREFERENCES_GEOFENCE_ENABLED, true);
}

From source file:Main.java

public static void markAnsweredLocalOrRemote(final Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    sp.edit().putBoolean(PREF_ANSWERED_LOCAL_OR_REMOTE, true).commit();
}

From source file:Main.java

public static void markDismissedIOExtendedCard(final Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    sp.edit().putBoolean(PREF_DISMISSED_IO_EXTENDED_CARD, true).commit();
}

From source file:Main.java

public static boolean hasDismissedIOExtendedCard(final Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    return sp.getBoolean(PREF_DISMISSED_IO_EXTENDED_CARD, false);
}

From source file:Main.java

public static void markDataBootstrapDone(final Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    sp.edit().putBoolean(PREF_DATA_BOOTSTRAP_DONE, true).commit();
}

From source file:Main.java

public static boolean isDataBootstrapDone(final Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    return sp.getBoolean(PREF_DATA_BOOTSTRAP_DONE, false);
}

From source file:Main.java

public static void markDebugWarningShown(final Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    sp.edit().putBoolean(PREF_DEBUG_BUILD_WARNING_SHOWN, true).commit();
}

From source file:Main.java

/**
 * Store if geofencing triggers will show a notification in app preferences.
 */// ww  w.ja v  a2 s .  co m
public static void storeGeofenceEnabled(Context context, boolean enable) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    SharedPreferences.Editor editor = prefs.edit();
    editor.putBoolean(PREFERENCES_GEOFENCE_ENABLED, enable);
    editor.apply();
}

From source file:Main.java

public static boolean wasDebugWarningShown(final Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    return sp.getBoolean(PREF_DEBUG_BUILD_WARNING_SHOWN, false);
}

From source file:Main.java

public static boolean hasUserRefusedSignIn(final Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    return sp.getBoolean(PREF_USER_REFUSED_SIGN_IN, false);
}