Google Smart Lock dialog for saving credentials does not appear when testing
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.
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.