问题
I am trying to save a user's facebook credentials to Google Smart Lock, but I am having difficulty testing. I was able to display the prompt to save once, but after I went into my saved passwords (passwords.google.com) and deleted the saved credentials, the prompt is not appearing anymore!
I went into google settings and made sure to delete the app from the "never save" section, but it is still not appearing. When I call Auth.CredentialsApi.save(), it is returning with a resolution of "null" and message "The current app is blacklisted"
回答1:
Double-check if the error message returned by the API is "The current app is blacklisted", which will be triggered when "Never" has been selected at some point in the past on the save dialog (details in the accepted answer: need to check for all accounts on the device).
And in general if you don't see the save dialog when testing, here are things to check:
try a real device (Android 4+) and not an emulator, ensure that the device is running the latest version of Google Play Services (8+) and has an active internet connection
verify that the device has at least one Google Account and that the account is in good state (doesn't require password re-entry and meets any corp policy requirements), for example, check that an email push notification for the account is successfully received by the device
in the Google Setting app > Smart Lock for Passwords (pre-Marshmallow) or Settings > Google > Smart Lock for Passwords (Marshmallow), ensure that at least once account on the device is shown with the Smart Lock for Passwords feature enabled and is not shown as disabled by passphrase encryption, see related question
in the same Smart Lock for Passwords settings activity, also check that app is not on the "Never save" list for any account on the device (as noted in the accepted answer). There is an account selector dropdown at the top of the settings activity UI.
check that the
Auth.CredentialsApi.save()
callback is being called, and theCredentialRequestResult
getStatus().getStatusCode()
isRESOLUTION_REQUIRED
and you've calledstartResolutionForResult()
. Sample appnote that the Activity from which you
startResolutionForResult()
must notfinish()
before the dialog is shown and user interaction is complete, callingonActivityResult()
also note that calling
Auth.CredentialsApi.save()
with a credential that has an email identifier matching a Google Account on the device and an account type set in place of a password, the save will succeed without resolution required. Similar for an update to an existing password credential with matching identifier. Check passwords.google.com for the Google Accounts on your device to see what credentials are currently saved
If none of these work, try adding a new Google Account to the device, and try another app with Smart Lock integration, such creating and saving an email-based account for the NYTimes app on your device and determine whether it is a device/account-specific issue or a problem with your app implementation, and feel free to leave a comment with details.
For a full guide to testing Smart Lock API integration in an app, check out this answer.
回答2:
I found a solution and wanted to post in case other people have this problem as well. The issue was that I had multiple google accounts on my device, and I needed to remove my app from the "Never save" list for each account.
回答3:
I was a struggle in the same issue when trying to log in the prompt dialog didn't pop up, and the onActivityResult wasn't triggered, to solve it, that I remove the android:noHistory = "true" from Manifest That was enough.
来源:https://stackoverflow.com/questions/31924627/google-smart-lock-dialog-for-saving-credentials-does-not-appear-when-testing