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


Java FacebookException.getMessage方法代碼示例

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


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

示例1: onWebDialogComplete

import com.facebook.FacebookException; //導入方法依賴的package包/類
void onWebDialogComplete(LoginClient.Request request, Bundle values,
        FacebookException error) {
    LoginClient.Result outcome;
    if (values != null) {
        // Actual e2e we got from the dialog should be used for logging.
        if (values.containsKey(ServerProtocol.DIALOG_PARAM_E2E)) {
            e2e = values.getString(ServerProtocol.DIALOG_PARAM_E2E);
        }

        try {
            AccessToken token = createAccessTokenFromWebBundle(
                    request.getPermissions(),
                    values,
                    AccessTokenSource.WEB_VIEW,
                    request.getApplicationId());
            outcome = LoginClient.Result.createTokenResult(
                    loginClient.getPendingRequest(),
                    token);

            // Ensure any cookies set by the dialog are saved
            // This is to work around a bug where CookieManager may fail to instantiate if
            // CookieSyncManager has never been created.
            CookieSyncManager syncManager =
                    CookieSyncManager.createInstance(loginClient.getActivity());
            syncManager.sync();
            saveCookieToken(token.getToken());
        } catch (FacebookException ex) {
            outcome = LoginClient.Result.createErrorResult(
                    loginClient.getPendingRequest(),
                    null,
                    ex.getMessage());
        }
    } else {
        if (error instanceof FacebookOperationCanceledException) {
            outcome = LoginClient.Result.createCancelResult(loginClient.getPendingRequest(),
                    "User canceled log in.");
        } else {
            // Something went wrong, don't log a completion event since it will skew timing
            // results.
            e2e = null;

            String errorCode = null;
            String errorMessage = error.getMessage();
            if (error instanceof FacebookServiceException) {
                FacebookRequestError requestError =
                        ((FacebookServiceException)error).getRequestError();
                errorCode = String.format(Locale.ROOT, "%d", requestError.getErrorCode());
                errorMessage = requestError.toString();
            }
            outcome = LoginClient.Result.createErrorResult(loginClient.getPendingRequest(),
                    null, errorMessage, errorCode);
        }
    }

    if (!Utility.isNullOrEmpty(e2e)) {
        logWebLoginCompleted(e2e);
    }

    loginClient.completeAndValidate(outcome);
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:61,代碼來源:WebViewLoginMethodHandler.java


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