Tôi đang thực hiện Google+ đăng nhập thông qua tài liệu hướng dẫn phát triển. Các phương thức onConnectionFailed
của tôi đang được gọi sau khi tôi chọn một tài khoản để đăng nhập bằng lỗi RESOLUTION_REQUIRED
(mã lỗi 6). Thao tác này sẽ khởi chạy hộp thoại 'Chọn tài khoản' khác sau đó hoạt động (đưa tôi đến quyền) nếu tôi chọn cùng một tài khoản. Tôi không chắc tại sao nó nhắc một hộp thoại khác. Tôi bắt đầu với resolveSignInError
Bất kỳ thông tin chi tiết nào?Google Plus đăng nhập 'Chọn một tài khoản' hộp thoại xuất hiện hai lần
Ngoài ra, việc chọn tài khoản từ 'Chọn tài khoản' sẽ hiển thị quyền, nếu tôi nhấn hủy tại thời điểm đó và chọn một tài khoản khác từ mặt số, nó sẽ hiển thị hình ảnh sai cho quyền hoặc đôi khi không có ảnh nào cả. Tôi cũng đã nhận được An internal error has occurred
bánh mì nướng một lần.
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
if (!mIntentInProgress) {
// Store the ConnectionResult so that we can use it later when the user clicks
// 'sign-in'.
mConnectionResult = connectionResult;
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();
}
}
}
private void resolveSignInError() {
if (mConnectionResult != null && mConnectionResult.hasResolution()) {
try {
mIntentInProgress = true;
startIntentSenderForResult(mConnectionResult.getResolution().getIntentSender(),
RC_SIGN_IN, null, 0, 0, 0);
} catch (IntentSender.SendIntentException e) {
// The intent was canceled before it was sent. Return to the default
// state and attempt to connect to get an updated ConnectionResult.
mIntentInProgress = false;
mGoogleApiClient.connect();
}
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RC_SIGN_IN) {
if (resultCode != RESULT_OK) {
mSignInClicked = false;
}
mIntentInProgress = false;
if (!mGoogleApiClient.isConnecting()) {
mGoogleApiClient.connect();
}
}
}
Cảm ơn. Tôi đã có một super.onActivityForResult() và loại bỏ nó (resp. Chỉ gọi nó khi tôi không tự xử lý kết quả) đã giải quyết được vấn đề. – Ridcully