正如标题所示,目前我正面临三星S7 Edge的问题,我的客户说他无法登录。登录使用Google登录。首先我认为这是因为Android M,但它不是(在使用Honor 5C测试应用程序之后)。其他手机(Android J,K和L)没问题。
由于我没有用于测试并在logcat中查看原因,是因为手机还是代码?
在OnCreate中:
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.addScope(new Scope(Scopes.EMAIL))
.addScope(new Scope(Scopes.PROFILE))
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
当用户单击“登录”按钮时:
private void registerWithGoogle() {
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, RC_SIGN_IN);
mGoogleApiClient.connect();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//If signin
if (requestCode == RC_SIGN_IN) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
//Calling a new function to handle signin
handleRegisterResult(result);
}
}
private void handleRegisterResult(GoogleSignInResult result) {
if (result.isSuccess()) {
//Getting google account
GoogleSignInAccount acct = result.getSignInAccount();
String name = acct.getDisplayName();
name = name.replace(" ", "%20");
String phoneNo = editTextPhoneNo.getText().toString();
phoneNo = phoneNo.replace("+", "%2B");
String email = acct.getEmail();
String code = textViewCode.getText().toString();
code = code.replace("+", "%2B");
registerUser(name,
phoneNo,
email,
code);
} else {
String msg = "Error when register";
snackBar(msg);
}
}
他总是Error when register
。或者还有其他原因导致问题吗?