Assigned
Status Update
Comments
bl...@google.com <bl...@google.com> #2
Automated by Blunderbuss job android-credential-manager-autoassigner for config android_credman_config for component 1301097.
sg...@google.com <sg...@google.com> #3
The error you posted state "activity is cancelled by the user". This implies the request was cancelled somehow during the request.
Can you grab a bugreport and attach it to this bug?
an...@google.com <an...@google.com> #4
Since this seems to be related to a specific device and specific version, I am not sure how we can debug that here. There us a statement in #1: "but the Xiaomi device works well with implementation 'com.google.android.gms:play-services-auth:20.2.0'" What does that mean exactly, and how did you test that?
hu...@metajoy.io <hu...@metajoy.io> #5
Hi, thanks for your response,
you mentioned "but the Xiaomi device works well with implementation 'com.google.android.gms:play-services-auth:20.2.0'", here is my code
private void loginGoogle(){
try {
if (0 < isGoogleAlreadyLogin()) {
Log.d("google_login", "loginGoogle: already login");
} else {
if (null == activity) {
return;
}
GoogleSignInOptions signInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestId()
.requestEmail()
.requestProfile()
.build();
GoogleSignInClient mGoogleSignInClient = GoogleSignIn.getClient(activity, signInOptions);
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
activity.startActivityForResult(signInIntent, requestCodeLoginGoogle);
}
}catch (Exception ignore){}
}
private int isGoogleAlreadyLogin() {
GoogleSignInOptions signInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestId()
.requestEmail()
.requestProfile()
.build();
GoogleSignInAccount signedInAccount = GoogleSignIn.getLastSignedInAccount(activity.getApplicationContext());
if (null != signedInAccount && GoogleSignIn.hasPermissions(signedInAccount, signInOptions.getScopeArray()))
{
Log.d("google_login", "isGoogleAlreadyLogin id:"+signedInAccount.getId()+" name:"+signedInAccount.getDisplayName());
return 1;
}
return 0;
}
after call loginGoogle() method, i can see popup UI let me choose a google account, and if i choose my gmail account, i can login successfully, so everything is ok if i use com.google.android.gms:play-services-auth:20.2.0, but not work with credentialmanager,
i tested with same device(Xiaomi note 3, android 9), same android project(it's a sample project), i create two button, click buton1 call loginGoogle() method and click button2 call loginGoogleWithCredentialManagerButton() method,
please let me know if you need any more infomation, thanks.
you mentioned "but the Xiaomi device works well with implementation 'com.google.android.gms:play-services-auth:20.2.0'", here is my code
private void loginGoogle(){
try {
if (0 < isGoogleAlreadyLogin()) {
Log.d("google_login", "loginGoogle: already login");
} else {
if (null == activity) {
return;
}
GoogleSignInOptions signInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestId()
.requestEmail()
.requestProfile()
.build();
GoogleSignInClient mGoogleSignInClient = GoogleSignIn.getClient(activity, signInOptions);
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
activity.startActivityForResult(signInIntent, requestCodeLoginGoogle);
}
}catch (Exception ignore){}
}
private int isGoogleAlreadyLogin() {
GoogleSignInOptions signInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestId()
.requestEmail()
.requestProfile()
.build();
GoogleSignInAccount signedInAccount = GoogleSignIn.getLastSignedInAccount(activity.getApplicationContext());
if (null != signedInAccount && GoogleSignIn.hasPermissions(signedInAccount, signInOptions.getScopeArray()))
{
Log.d("google_login", "isGoogleAlreadyLogin id:"+signedInAccount.getId()+" name:"+signedInAccount.getDisplayName());
return 1;
}
return 0;
}
after call loginGoogle() method, i can see popup UI let me choose a google account, and if i choose my gmail account, i can login successfully, so everything is ok if i use com.google.android.gms:play-services-auth:20.2.0, but not work with credentialmanager,
i tested with same device(Xiaomi note 3, android 9), same android project(it's a sample project), i create two button, click buton1 call loginGoogle() method and click button2 call loginGoogleWithCredentialManagerButton() method,
please let me know if you need any more infomation, thanks.
hu...@metajoy.io <hu...@metajoy.io>
hu...@metajoy.io <hu...@metajoy.io> #6
Hello, somebody help?
xu...@drojian.dev <xu...@drojian.dev> #7
I have also encountered a problem similar to yours.
he...@google.com <he...@google.com>
bl...@google.com <bl...@google.com> #8
Automated by Blunderbuss job android-credential-manager-autoassigner for config android_credman_config for component 1301097.
xu...@gmail.com <xu...@gmail.com> #9
I encountered the same issue, and it might be related to your Google Play Services installation. In my case, Google Services were installed later, and since it is treated as a regular app on Xiaomi devices, some permissions might be restricted. After enabling the “Background pop-up” permission, it started working normally. This is just my guess, but I hope it helps you.
hu...@metajoy.io <hu...@metajoy.io> #10
Hi, Thanks for your response,
after i turn on the Google Play Services's "Background pop-up" permission, i can see the dialog which let me choose account, but after i choose one account, still got "androidx.credentials.exceptions.GetCredentialCancellationException: activity is cancelled by the user" error,
i also turn on my app and the Google Play Store's "Background pop-up" permission but still not work, i don't know how to fix this, please help. thanks.
at last, this is my test device, i can turn on the “Background pop-up” permission, but how about online player's device? the 'com.google.android.gms:play-services-auth:20.2.0' works well without “Background pop-up” permission, why CredentialManager need this permission? please help. thanks.
after i turn on the Google Play Services's "Background pop-up" permission, i can see the dialog which let me choose account, but after i choose one account, still got "androidx.credentials.exceptions.GetCredentialCancellationException: activity is cancelled by the user" error,
i also turn on my app and the Google Play Store's "Background pop-up" permission but still not work, i don't know how to fix this, please help. thanks.
at last, this is my test device, i can turn on the “Background pop-up” permission, but how about online player's device? the 'com.google.android.gms:play-services-auth:20.2.0' works well without “Background pop-up” permission, why CredentialManager need this permission? please help. thanks.
ee...@gmail.com <ee...@gmail.com> #11
Hello, I encountered a similar issue that google login always return "user cancel". After changing the OAuth Publishing Status from "Testing" to "Production," the issue was resolved. I'm wondering whether this behavior is intentional or if it might be a bug.
Description
Version used:
implementation "androidx.credentials:credentials:1.3.0"
implementation "androidx.credentials:credentials-play-services-auth:1.3.0"
implementation "com.google.android.libraries.identity.googleid:googleid:1.1.1"
implementation 'com.google.api-client:google-api-client:2.7.0'
Devices/Android versions reproduced on:
Xiaomi note 3, android 9
If this is a bug in the library, we would appreciate if you could attach:
- Sample project to trigger the issue.
- A screenrecord or screenshots showing the issue (if UI related).
here is my code, i repleaced "my web client id" for security
private void loginGoogleWithCredentialManagerButton()
{
GetSignInWithGoogleOption googleIdOption = new GetSignInWithGoogleOption.Builder("my web client id")
.build();
CredentialManager credentialManager = CredentialManager.create(activity);
GetCredentialRequest getCredRequest = new GetCredentialRequest.Builder()
.addCredentialOption(googleIdOption)
.build();
CancellationSignal cancellationSignal = new CancellationSignal();
cancellationSignal.setOnCancelListener(new CancellationSignal.OnCancelListener() {
@Override
public void onCancel() {
Log.e("google_login", "signin failed with cancel");
}
});
credentialManager.getCredentialAsync(
// Use activity based context to avoid undefined
// system UI launching behavior
activity,
getCredRequest,
cancellationSignal,
Executors.newSingleThreadExecutor(),
new CredentialManagerCallback<GetCredentialResponse, GetCredentialException>() {
@Override
public void onResult(GetCredentialResponse result) {
handleSignIn(result);
}
@Override
public void onError(GetCredentialException e) {
Log.e("google_login", "signin failed:"+e.toString());
e.printStackTrace();
}
}
);
}
the method works well on our other devices(sumsung, pixel), but i always got "androidx.credentials.exceptions.GetCredentialCancellationException: activity is cancelled by the user" error on Xiaomi note 3(OS version Android 9) without any UI popup.
but the Xiaomi device works well with implementation 'com.google.android.gms:play-services-auth:20.2.0'
i also tried the latest version of androidx.credentials:credentials/androidx.credentials:credentials-play-services-auth/com.google.android.libraries.identity.googleid:googleid, still got same error.
i also tried login with GetGoogleIdOption, still got same error.
here is the Xiaomi note 3(OS version Android 9)'s google version "isGooglePlayServicesAvaiable:0 clientversion:12451000" with these code
void isGooglePlayServicesAvaiable(){
//ConnectionResult.SUCCESS ==
Log.e("google_login", "isGooglePlayServicesAvaiable:"+GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(this.getApplicationContext())
+" clientversion:"+GoogleApiAvailability.getInstance().getClientVersion(this));
}
and the Xiaomi's google play service version is 24.44.33 which i checked from settings.
i have no idea how to resolve this issue, please help.