2

Google+ サインインに問題があります。ここに私の googleApiClientBuilder があります

15〜20回試行した後、1回ログインに成功しましたが、その後は問題なく、常に他の方法でログインしていますif (result.isSuccess())

Start で googleApi に接続しました

GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestScopes(new Scope(Plus.SCOPE_PLUS_LOGIN.toString()))
            .requestEmail()
            .requestId()
            .requestProfile()
            .build();
    mGoogleApiClient = new GoogleApiClient.Builder(this)
            .enableAutoManage(this, this)
            .addApi(Plus.API, Plus.PlusOptions.builder().build())
            .addScope(Plus.SCOPE_PLUS_LOGIN)
            .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
            .build();
    SignInButton googlePlusSignInButton = (SignInButton) findViewById(R.id.act_reg_gpsi_login);
    if (googlePlusSignInButton != null) {

        googlePlusSignInButton.setScopes(gso.getScopeArray());
        googlePlusSignInButton.setOnClickListener(this);

    } 

サインイン

private void handleSignInResult(GoogleSignInResult result) {
    if (result.isSuccess()) {
        // Signed in successfully, show authenticated UI.
        GoogleSignInAccount googleSignInAccount = result.getSignInAccount();
        if (googleSignInAccount != null) {
            pdLoginWithSocialMedia = UIUtility.createProgressDialog(this, "Please wait", "Logging in");
            performSocialLogin(LoginFrom.GOOGLE_PLUS,
                    googleSignInAccount.getId(),
                    googleSignInAccount.getDisplayName(),
                    (googleSignInAccount.getPhotoUrl() != null) ? googleSignInAccount.getPhotoUrl().toString() : "",
                    (googleSignInAccount.getPhotoUrl() != null) ? googleSignInAccount.getPhotoUrl().toString() : "",
                    googleSignInAccount.getEmail(),
                    "",
                    2);
        } else {
            showSignUpLoginIssue(ErrorIssue.ERR_UNKNOWN);
        }
//            updateUI(true);
    } else {
        showSignUpLoginIssue(ErrorIssue.ERR_UNKNOWN);
    }
}

Response を処理する StartActivity

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    LISessionManager.getInstance(getApplicationContext()).onActivityResult(this, requestCode, resultCode, data);
    if (requestCode == RC_SIGN_IN) {
        if (resultCode == RESULT_OK) {
            GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
            handleSignInResult(result);
        int statusCode = result.getStatus().getStatusCode();
        } else {
            showSignUpLoginIssue(ErrorIssue.ERR_UNKNOWN);
        }
    } else {
        callbackManager.onActivityResult(requestCode, resultCode, data);
    }
}
4

0 に答える 0