Пример #1
0
 /**
  * save the access token to shared prefs ... we always look in the provider first and if we have
  * one from the provider we use that since an access token may have come in to our SyncService
  * while our activities were stopped and the service would still put it into the provider - but if
  * the provider does not have one we use the one from the shared pref, so we save it there ... the
  * key thing to keep in mind is that the provider is not actually a persistence mechanism for us,
  * it just represents the last info sent to us from the server, and if the server sent us an
  * incomplete record that did not include an access token, we won't be able to get the access
  * token from the server ... we use the access token to refresh everything else
  */
 private void saveAccessTokenToSharedPref() {
   // don't forget prior access token - that's not what this is for
   if ((null != mAccessToken) && (0 < mAccessToken.length()))
     SharedPrefHelper.saveAccessToken(mContext, mAccessToken);
 }
Пример #2
0
 /**
  * separate call to clear access token from shared preferences - necessary because we
  * intentionally don't clear the shared pref when CTUser.clear() is called, because generally
  * speaking clearing the access token is an extreme measure that we only do when the user
  * explicitly logs out
  */
 public void clearAccessToken() {
   mAccessToken = null;
   SharedPrefHelper.deleteAccessToken(mContext);
 }
Пример #3
0
 /**
  * get the access token from shared prefs ... we always look in the provider first and if we have
  * one from the provider we use that since an access token may have come in to our SyncService
  * while our activities were stopped and the service would still put it into the provider - but if
  * the provider does not have one we use the one from the shared pref
  */
 private void getAccessTokenFromSharedPref() {
   mAccessToken = SharedPrefHelper.getAccessToken(mContext);
 }