Search in sources :

Example 36 with SharedPreferences

use of android.content.SharedPreferences in project glitch-hq-android by tinyspeck.

the class C2DMessaging method getRegistrationId.

/**
     * Return the current registration id.
     *
     * If result is empty, the registration has failed.
     *
     * @return registration id, or empty string if the registration is not complete.
     */
public static String getRegistrationId(Context context) {
    final SharedPreferences prefs = context.getSharedPreferences(PREFERENCE, Context.MODE_PRIVATE);
    String registrationId = prefs.getString("dm_registration", "");
    return registrationId;
}
Also used : SharedPreferences(android.content.SharedPreferences)

Example 37 with SharedPreferences

use of android.content.SharedPreferences in project glitch-hq-android by tinyspeck.

the class C2DMessaging method setRegistrationId.

// package
static void setRegistrationId(Context context, String registrationId) {
    final SharedPreferences prefs = context.getSharedPreferences(PREFERENCE, Context.MODE_PRIVATE);
    Editor editor = prefs.edit();
    editor.putString("dm_registration", registrationId);
    editor.commit();
}
Also used : SharedPreferences(android.content.SharedPreferences) Editor(android.content.SharedPreferences.Editor)

Example 38 with SharedPreferences

use of android.content.SharedPreferences in project glitch-hq-android by tinyspeck.

the class C2DMessaging method clearRegistrationId.

// package
static void clearRegistrationId(Context context) {
    final SharedPreferences prefs = context.getSharedPreferences(PREFERENCE, Context.MODE_PRIVATE);
    Editor editor = prefs.edit();
    editor.putString("dm_registration", "");
    editor.putLong(LAST_REGISTRATION_CHANGE, System.currentTimeMillis());
    editor.commit();
}
Also used : SharedPreferences(android.content.SharedPreferences) Editor(android.content.SharedPreferences.Editor)

Example 39 with SharedPreferences

use of android.content.SharedPreferences in project glitch-hq-android by tinyspeck.

the class C2DMessaging method setBackoff.

static void setBackoff(Context context, long backoff) {
    final SharedPreferences prefs = context.getSharedPreferences(PREFERENCE, Context.MODE_PRIVATE);
    Editor editor = prefs.edit();
    editor.putLong(BACKOFF, backoff);
    editor.commit();
}
Also used : SharedPreferences(android.content.SharedPreferences) Editor(android.content.SharedPreferences.Editor)

Example 40 with SharedPreferences

use of android.content.SharedPreferences in project glimmr by brk3.

the class OAuthUtils method logout.

/**
     * Clear all user data from SharedPreferences and return to ExploreActivity.
     * @param context
     */
public static void logout(Context context) {
    SharedPreferences prefs = context.getSharedPreferences(Constants.PREFS_NAME, Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = prefs.edit();
    editor.remove(Constants.KEY_OAUTH_TOKEN);
    editor.remove(Constants.KEY_TOKEN_SECRET);
    editor.remove(Constants.KEY_ACCOUNT_USER_NAME);
    editor.remove(Constants.KEY_ACCOUNT_USER_ID);
    editor.commit();
    Intent exploreActivity = new Intent(context, ExploreActivity.class);
    exploreActivity.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    context.startActivity(exploreActivity);
}
Also used : SharedPreferences(android.content.SharedPreferences) Intent(android.content.Intent)

Aggregations

SharedPreferences (android.content.SharedPreferences)1762 Intent (android.content.Intent)221 View (android.view.View)110 Editor (android.content.SharedPreferences.Editor)100 TextView (android.widget.TextView)74 ArrayList (java.util.ArrayList)67 Context (android.content.Context)59 PendingIntent (android.app.PendingIntent)57 File (java.io.File)57 IOException (java.io.IOException)56 Bundle (android.os.Bundle)45 JSONException (org.json.JSONException)41 JSONObject (org.json.JSONObject)41 DialogInterface (android.content.DialogInterface)37 AdapterView (android.widget.AdapterView)34 ImageView (android.widget.ImageView)34 ListView (android.widget.ListView)34 SuppressLint (android.annotation.SuppressLint)33 JSONArray (run.wallet.common.json.JSONArray)33 ComponentName (android.content.ComponentName)31