I have integrated sign in with google in my android application, now issue is that in some device its not working,but in my emulator and in some device it is working fine,what is the issue?
https://developers.google.com/identity/sign-in/android/
http://www.androidhive.info/2014/02/android-login-with-google-plus-account-1/
this two tutorials to sign in, but when i run my app, and try to login it allows to select account,but when i click on that in my logcat it shows
System.out: Google logout
CODE
private void handleSignInResult(GoogleSignInResult result) {
Log.d("", "handleSignInResult:" + result.isSuccess());
if (result.isSuccess()) {
// Signed in successfully, show authenticated UI.
GoogleSignInAccount acct = result.getSignInAccount();
Log.e("", "display name: " + acct.getDisplayName());
personName = acct.getDisplayName();
personPhotoUrl = String.valueOf(acct.getPhotoUrl());
ggoleemail = acct.getEmail();
googleid = "G" + acct.getId();
// String baday = String.valueOf(acct.getAccount());
Log.e(TAG, "Name: " + personName + googleid + ", email: " + ggoleemail
+ ", Image: " + personPhotoUrl);
/* txtName.setText(personName);
txtEmail.setText(email);
Glide.with(getApplicationContext()).load(personPhotoUrl)
.thumbnail(0.5f)
.crossFade()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(imgProfilePic);
*/
googleslogins();
// updateUI(true);
} else {
// Signed out, show unauthenticated UI.
//updateUI(false);
System.out.println("Google logout");
}
}
Have you added your certificate's hash on Google developer console and turned on the APIs in the Google API manager?
APIs - GooglePlus and People Api
Based from this thread, you're getting an error maybe because the user's account is attached to both a hosted account and a Google account, and probably it has different passwords for each The authentication servers currently do not handle this well. Follow this Connecting to Google Drive with Google APIs Client Library for Java tutorial.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
// Google Accounts using OAuth2
m_credential = GoogleAccountCredential.usingOAuth2(this, Collections.singleton(DriveScopes.DRIVE));
m_client = new com.google.api.services.drive.Drive.Builder(
m_transport, m_jsonFactory, m_credential).setApplicationName("AppName/1.0")
.build();
...
}
You can also check on these related issues:
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With