Google Smart Lock dialog not showing on Android O devices

I recently included GoogleSmartLock in my application. Somehow, the save dialog does not appear on Android O devices, and the API throws the following error.

The Credentials API confirmation dialog box opens to avoid conflicts with the Android Autofill feature. This selection can be overridden through AuthCredentialsOptions.Builder.forceEnableSaveDialog ()., Resolution = NULL}

I checked the latest versions of notes in playback services and found that the following API could solve this problem.

Auth.AuthCredentialsOptions.Builder forceEnableSaveDialog ()

But I'm not sure how to use this api with GoogleApIClient as it does not have a build method that technically should return an AuthCredentialOptions instance. Please let me know if anyone is facing the same problem.

+6
source share
3 answers

Update 1: This issue is resolved in the latest version (version 11.8.0):

Code examples (as well as further usage documentation .forceEnableSaveDialog) are available in the "Targeting Android O and Above" section of the overview documentation and have been updated to use the new parameter class.

+4
source

The build () method was missing from the public SDK for AuthCredentialsOptions.Builder, and we fixed it (see accepted answer)

: Google Smart Lock, , , API (, API, ... ). , , Smart Lock ( Autofill), Google Chrome ( API).

, Autofill Google, Google , Oreo. , , . .

+4

I managed to use reflection for this workaround:

Auth.AuthCredentialsOptions authCredentialsOptions = null;
try {
    Constructor<Auth.AuthCredentialsOptions> constructor = Auth.AuthCredentialsOptions.class.getDeclaredConstructor(Auth.AuthCredentialsOptions.Builder.class);
    constructor.setAccessible(true);
    authCredentialsOptions = constructor.newInstance(new Auth.AuthCredentialsOptions.Builder().forceEnableSaveDialog());
} catch (Exception e) {
    e.printStackTrace();
}
GoogleApiClient.Builder builder = new GoogleApiClient.Builder(this)
        .addConnectionCallbacks(this)
        .enableAutoManage(this, 0, this);
if (authCredentialsOptions != null) {
    builder.addApi(Auth.CREDENTIALS_API, authCredentialsOptions);
} else {
    builder.addApi(Auth.CREDENTIALS_API);
}
mGoogleApiClient = builder.build();
+1
source

All Articles