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


Java Utility.getBundleLongAsDate方法代碼示例

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


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

示例1: createAccessTokenFromNativeLogin

import com.facebook.internal.Utility; //導入方法依賴的package包/類
static AccessToken createAccessTokenFromNativeLogin(
        Bundle bundle,
        AccessTokenSource source,
        String applicationId) {
    Date expires = Utility.getBundleLongAsDate(
            bundle, NativeProtocol.EXTRA_EXPIRES_SECONDS_SINCE_EPOCH, new Date(0));
    ArrayList<String> permissions = bundle.getStringArrayList(NativeProtocol.EXTRA_PERMISSIONS);
    String token = bundle.getString(NativeProtocol.EXTRA_ACCESS_TOKEN);

    if (Utility.isNullOrEmpty(token)) {
        return null;
    }

    String userId = bundle.getString(NativeProtocol.EXTRA_USER_ID);

    return new AccessToken(
            token,
            applicationId,
            userId,
            permissions,
            null,
            source,
            expires,
            new Date());
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:26,代碼來源:LoginMethodHandler.java

示例2: createFromRefresh

import com.facebook.internal.Utility; //導入方法依賴的package包/類
@SuppressLint("FieldGetter")
static AccessToken createFromRefresh(AccessToken current, Bundle bundle) {
    // Only tokens obtained via SSO support refresh. Token refresh returns the expiration date
    // in seconds from the epoch rather than seconds from now.
    if (current.source != AccessTokenSource.FACEBOOK_APPLICATION_WEB &&
            current.source != AccessTokenSource.FACEBOOK_APPLICATION_NATIVE &&
            current.source != AccessTokenSource.FACEBOOK_APPLICATION_SERVICE) {
        throw new FacebookException("Invalid token source: " + current.source);
    }

    Date expires = Utility.getBundleLongAsDate(bundle, EXPIRES_IN_KEY, new Date(0));
    String token = bundle.getString(ACCESS_TOKEN_KEY);

    if (Utility.isNullOrEmpty(token)) {
        return null;
    }
    return new AccessToken(
            token,
            current.applicationId,
            current.getUserId(),
            current.getPermissions(),
            current.getDeclinedPermissions(),
            current.source,
            expires,
            new Date());
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:27,代碼來源:AccessToken.java

示例3: createFromBundle

import com.facebook.internal.Utility; //導入方法依賴的package包/類
private static AccessToken createFromBundle(
        List<String> requestedPermissions,
        Bundle bundle,
        AccessTokenSource source,
        Date expirationBase,
        String applicationId) {
    String token = bundle.getString(ACCESS_TOKEN_KEY);
    Date expires = Utility.getBundleLongAsDate(bundle, EXPIRES_IN_KEY, expirationBase);
    String userId = bundle.getString(USER_ID_KEY);

    if (Utility.isNullOrEmpty(token) || (expires == null)) {
        return null;
    }

    return new AccessToken(
            token,
            applicationId,
            userId,
            requestedPermissions,
            null,
            source,
            expires,
            new Date());
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:25,代碼來源:AccessToken.java

示例4: createAccessTokenFromWebBundle

import com.facebook.internal.Utility; //導入方法依賴的package包/類
public static AccessToken createAccessTokenFromWebBundle(
        Collection<String> requestedPermissions,
        Bundle bundle,
        AccessTokenSource source,
        String applicationId) throws FacebookException {
    Date expires = Utility.getBundleLongAsDate(bundle, AccessToken.EXPIRES_IN_KEY, new Date());
    String token = bundle.getString(AccessToken.ACCESS_TOKEN_KEY);

    // With Login v4, we now get back the actual permissions granted, so update the permissions
    // to be the real thing
    String grantedPermissions = bundle.getString("granted_scopes");
    if (!Utility.isNullOrEmpty(grantedPermissions)) {
        requestedPermissions = new ArrayList<String>(
                Arrays.asList(grantedPermissions.split(",")));
    }
    String deniedPermissions = bundle.getString("denied_scopes");
    List<String> declinedPermissions = null;
    if (!Utility.isNullOrEmpty(deniedPermissions)) {
        declinedPermissions = new ArrayList<String>(
                Arrays.asList(deniedPermissions.split(",")));
    }

    if (Utility.isNullOrEmpty(token)) {
        return null;
    }

    String signed_request = bundle.getString("signed_request");
    String userId = getUserIDFromSignedRequest(signed_request);

    return new AccessToken(
            token,
            applicationId,
            userId,
            requestedPermissions,
            declinedPermissions,
            source,
            expires,
            new Date());
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:40,代碼來源:LoginMethodHandler.java


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