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;
}
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();
}
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();
}
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();
}
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);
}
Aggregations