com.google.android.gms.auth.api.credentials.CredentialPickerConfig Java Examples

The following examples show how to use com.google.android.gms.auth.api.credentials.CredentialPickerConfig. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java    From identity-samples with Apache License 2.0 6 votes vote down vote up
/**
     * Called when the Load Hints button is clicked. Requests a Credential "hint" which will
     * be the basic profile information and an ID token for an account on the device. This is useful
     * to auto-fill sign-up forms with an email address, picture, and name or to do password-free
     * authentication with a server by providing an ID Token.
     */
    private void loadHintClicked() {
        HintRequest hintRequest = new HintRequest.Builder()
                .setHintPickerConfig(new CredentialPickerConfig.Builder()
                        .setShowCancelButton(true)
                        .build())
                .setIdTokenRequested(shouldRequestIdToken())
                .setEmailAddressIdentifierSupported(true)
                .setAccountTypes(IdentityProviders.GOOGLE)
                .build();

;
        PendingIntent intent = mCredentialsClient.getHintPickerIntent(hintRequest);
        try {
            startIntentSenderForResult(intent.getIntentSender(), RC_HINT, null, 0, 0, 0);
            mIsResolving = true;
        } catch (IntentSender.SendIntentException e) {
            Log.e(TAG, "Could not start hint picker Intent", e);
            mIsResolving = false;
        }
    }
 
Example #2
Source File: PhoneNumberActivity.java    From identity-samples with Apache License 2.0 6 votes vote down vote up
private void showHint() {
    ui.clearKeyboard();
    HintRequest hintRequest = new HintRequest.Builder()
            .setHintPickerConfig(new CredentialPickerConfig.Builder()
                    .setShowCancelButton(true)
                    .build())
            .setPhoneNumberIdentifierSupported(true)
            .build();

    PendingIntent intent =
            Auth.CredentialsApi.getHintPickerIntent(mCredentialsApiClient, hintRequest);
    try {
        startIntentSenderForResult(intent.getIntentSender(), RC_HINT, null, 0, 0, 0);
    } catch (IntentSender.SendIntentException e) {
        Log.e(TAG, "Could not start hint picker Intent", e);
    }
}
 
Example #3
Source File: MainActivity.java    From journaldev with MIT License 6 votes vote down vote up
public void showHintDialog() {
    HintRequest hintRequest = new HintRequest.Builder()
            .setHintPickerConfig(new CredentialPickerConfig.Builder()
                    .setShowCancelButton(true)
                    .build())
            .setEmailAddressIdentifierSupported(true)
            .setAccountTypes(IdentityProviders.GOOGLE, IdentityProviders.FACEBOOK)
            .build();

    PendingIntent intent = mCredentialsApiClient.getHintPickerIntent(hintRequest);
    try {
        startIntentSenderForResult(intent.getIntentSender(), RC_HINT, null, 0, 0, 0);
    } catch (IntentSender.SendIntentException e) {
        Log.e(TAG, "Could not start hint picker Intent", e);
    }
}
 
Example #4
Source File: MainActivity.java    From android-credentials with Apache License 2.0 6 votes vote down vote up
/**
     * Called when the Load Hints button is clicked. Requests a Credential "hint" which will
     * be the basic profile information and an ID token for an account on the device. This is useful
     * to auto-fill sign-up forms with an email address, picture, and name or to do password-free
     * authentication with a server by providing an ID Token.
     */
    private void loadHintClicked() {
        HintRequest hintRequest = new HintRequest.Builder()
                .setHintPickerConfig(new CredentialPickerConfig.Builder()
                        .setShowCancelButton(true)
                        .build())
                .setIdTokenRequested(shouldRequestIdToken())
                .setEmailAddressIdentifierSupported(true)
                .setAccountTypes(IdentityProviders.GOOGLE)
                .build();

;
        PendingIntent intent = mCredentialsClient.getHintPickerIntent(hintRequest);
        try {
            startIntentSenderForResult(intent.getIntentSender(), RC_HINT, null, 0, 0, 0);
            mIsResolving = true;
        } catch (IntentSender.SendIntentException e) {
            Log.e(TAG, "Could not start hint picker Intent", e);
            mIsResolving = false;
        }
    }
 
Example #5
Source File: PhoneNumberActivity.java    From android-credentials with Apache License 2.0 6 votes vote down vote up
private void showHint() {
    ui.clearKeyboard();
    HintRequest hintRequest = new HintRequest.Builder()
            .setHintPickerConfig(new CredentialPickerConfig.Builder()
                    .setShowCancelButton(true)
                    .build())
            .setPhoneNumberIdentifierSupported(true)
            .build();

    PendingIntent intent =
            Auth.CredentialsApi.getHintPickerIntent(mCredentialsApiClient, hintRequest);
    try {
        startIntentSenderForResult(intent.getIntentSender(), RC_HINT, null, 0, 0, 0);
    } catch (IntentSender.SendIntentException e) {
        Log.e(TAG, "Could not start hint picker Intent", e);
    }
}
 
Example #6
Source File: SmartLock.java    From easygoogle with Apache License 2.0 5 votes vote down vote up
private CredentialRequest buildCredentialRequest() {
    return new CredentialRequest.Builder()
            .setCredentialPickerConfig(new CredentialPickerConfig.Builder()
                .setShowAddAccountButton(false)
                .setShowCancelButton(true)
                .setForNewAccount(false)
                .build())
            .setPasswordLoginSupported(true)
            .build();
}