最近我一直在處理Android上的Google+登錄,有一件事讓我煩惱。爲什麼Google+登錄會導致登錄錯誤?
在所有官方認可的示例中,都沒有專門顯示登錄過程的方法。被稱爲每次嘗試登錄有人在叫resolveSignInError()時間的方法如下所示:
private void resolveSignInError() {
if (mConnectionResult.hasResolution()) {
try {
mIntentInProgress = true;
mConnectionResult.startResolutionForResult(this, RC_SIGN_IN);
Log.d("mGoogleApiClient ", mGoogleApiClient.toString());
} catch (IntentSender.SendIntentException e) {
mIntentInProgress = false;
mGoogleApiClient.connect();
}
}
}
此方法還依賴於一個事實,即有一個mConnectionResult,這是在設置連接失敗的方法
public void onConnectionFailed(ConnectionResult result) {
if (!result.hasResolution()) {
GooglePlayServicesUtil.getErrorDialog(result.getErrorCode(), this,
0).show();
return;
}
if (!mIntentInProgress) {
// Store the ConnectionResult for later usage
mConnectionResult = result;
if (mSignInClicked) {
// The user has already clicked 'sign-in' so we attempt to
// resolve all
// errors until the user is signed in, or they cancel.
resolveSignInError();
}
}
}
因此,整個計劃圍繞已經無法登錄至少一次。 有沒有人知道爲什麼沒有一種方法,直接登錄到谷歌加嗎? 爲什麼這是有意義的結構可讀的軟件?
非常感謝您的明確解釋! –
@MichaelAlanHuff http://stackoverflow.com/questions/31283697/how-to-solve-error-while-implementing-sign-in-with-google-plus-and-facebook-in-a?noredirect=1#comment50561722_31283697你能幫我嗎? –