當前位置: 首頁>>代碼示例>>Java>>正文


Java AccessToken.isExpired方法代碼示例

本文整理匯總了Java中com.facebook.AccessToken.isExpired方法的典型用法代碼示例。如果您正苦於以下問題:Java AccessToken.isExpired方法的具體用法?Java AccessToken.isExpired怎麽用?Java AccessToken.isExpired使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.facebook.AccessToken的用法示例。


在下文中一共展示了AccessToken.isExpired方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isLoggedIn

import com.facebook.AccessToken; //導入方法依賴的package包/類
public boolean isLoggedIn() {
    AccessToken accessToken = AccessToken.getCurrentAccessToken();
    Log.d("token",accessToken+"");
    if (accessToken != null) {
        if (!accessToken.isExpired()) {
            return true;
        }
        return false;
    }
    return false;
}
 
開發者ID:movers-gcw,項目名稱:movemate_android,代碼行數:12,代碼來源:LoginActivity.java

示例2: getSignedInToken

import com.facebook.AccessToken; //導入方法依賴的package包/類
/**
 * @return the Facebook AccessToken when signed-in with a non-expired token.
 */
private AccessToken getSignedInToken() {
    final AccessToken accessToken = AccessToken.getCurrentAccessToken();
    if (accessToken != null && !accessToken.isExpired()) {
        Log.d(LOG_TAG, "Facebook Access Token is OK");
        return accessToken;
    }

    Log.d(LOG_TAG,"Facebook Access Token is null or expired.");
    return null;
}
 
開發者ID:jtran064,項目名稱:PlatePicks-Android,代碼行數:14,代碼來源:FacebookSignInProvider.java

示例3: refreshFacebookCredentials

import com.facebook.AccessToken; //導入方法依賴的package包/類
/**
 * Refresh cognito credentials based on identity token previously obtained from Facebook
 * @param onCompletion a runnable that will be executed once the credentials have been successfully renewed
 */
private void refreshFacebookCredentials(Runnable onCompletion) {

    Log.v(TAG, "Will try to refresh Facebook token as session has expired...");

    final AccessToken accessToken = AccessToken.getCurrentAccessToken();

    if (!accessToken.isExpired()) {

        Log.v(TAG, String.format("  -> Facebook token is not expired (expiration %s)...", SimpleDateFormat.getInstance().format(accessToken.getExpires())));
        String token = accessToken.getToken();

        Map<String, String> logins = new HashMap<>();
        logins.put(FACEBOOK_LOGIN, token);

        Log.v(TAG, "  -> will refresh login for " + FACEBOOK_LOGIN);

        // Refreshing session credentials (must be asynchronous)...
        new RefreshTokenTask(onCompletion).execute(logins);

        // We use the opportunity to refresh the Facebook token
        Date now = new Date();
        if (accessToken.getLastRefresh().getTime() < (now.getTime() - 7 * 86400)) {
            Log.v(TAG, "  -> triggering async facebook token refresh");
            AccessToken.refreshCurrentAccessTokenAsync();
        }

    } else {

        Log.v(TAG, String.format("  -> Facebook token is expired (expiration %s)...", SimpleDateFormat.getInstance().format(accessToken.getExpires())));
        //User has to sign in to refresh an elapsed facebook token
        // TODO onCompletion is ignored (should be dealt with in onActivityResult)
        Intent intent = new Intent(this, SignInActivity.class);
        this.startActivity(intent);

    }
}
 
開發者ID:ironbird-software,項目名稱:aws-cognito-sync-issues,代碼行數:41,代碼來源:MainActivity.java

示例4: onViewCreated

import com.facebook.AccessToken; //導入方法依賴的package包/類
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  super.onViewCreated(view, savedInstanceState);
  AccessToken accessToken = AccessToken.getCurrentAccessToken();
  if (accessToken != null) {
    if (!accessToken.isExpired()) {
      changeFacebookState(true);
    }
  }
}
 
開發者ID:Aptoide,項目名稱:aptoide-client-v8,代碼行數:10,代碼來源:AddressBookFragment.java

示例5: isLoggedIn

import com.facebook.AccessToken; //導入方法依賴的package包/類
/**
 * Check if user is loggedIn
 * @return true id accessToken is not expired, false otherwise.
 */
public boolean isLoggedIn() {
    AccessToken accessToken = getAccessToken();
    return accessToken != null && !accessToken.isExpired();
}
 
開發者ID:WassimBenltaief,項目名稱:ReactiveFB,代碼行數:9,代碼來源:SessionManager.java


注:本文中的com.facebook.AccessToken.isExpired方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。