com.google.android.gms.auth.api.credentials.HintRequest Java Examples
The following examples show how to use
com.google.android.gms.auth.api.credentials.HintRequest.
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 |
/** * 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 |
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 |
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 |
/** * 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 |
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: CheckEmailHandler.java From FirebaseUI-Android with Apache License 2.0 | 5 votes |
public void fetchCredential() { setResult(Resource.<User>forFailure(new PendingIntentRequiredException( Credentials.getClient(getApplication()).getHintPickerIntent( new HintRequest.Builder().setEmailAddressIdentifierSupported(true).build()), RequestCodes.CRED_HINT ))); }
Example #7
Source File: CheckPhoneHandler.java From FirebaseUI-Android with Apache License 2.0 | 5 votes |
public void fetchCredential() { setResult(Resource.<PhoneNumber>forFailure(new PendingIntentRequiredException( Credentials.getClient(getApplication()).getHintPickerIntent( new HintRequest.Builder().setPhoneNumberIdentifierSupported(true).build()), RequestCodes.CRED_HINT ))); }
Example #8
Source File: PhoneNumberHelper.java From react-native-sms-retriever with MIT License | 4 votes |
void requestPhoneNumber(@NonNull final Context context, final Activity activity, final Promise promise) { if (promise == null) { callAndResetListener(); return; } mPromise = promise; if (!GooglePlayServicesHelper.isAvailable(context)) { promiseReject(GooglePlayServicesHelper.UNAVAILABLE_ERROR_TYPE, GooglePlayServicesHelper.UNAVAILABLE_ERROR_MESSAGE); callAndResetListener(); return; } if (!GooglePlayServicesHelper.hasSupportedVersion(context)) { promiseReject(GooglePlayServicesHelper.UNSUPORTED_VERSION_ERROR_TYPE, GooglePlayServicesHelper.UNSUPORTED_VERSION_ERROR_MESSAGE); callAndResetListener(); return; } if (activity == null) { promiseReject(ACTIVITY_NULL_ERROR_TYPE, ACTIVITY_NULL_ERROR_MESSAGE); callAndResetListener(); return; } final HintRequest request = new HintRequest.Builder() .setPhoneNumberIdentifierSupported(true) .build(); final GoogleApiClient googleApiClient = getGoogleApiClient(context, activity); final PendingIntent intent = Auth.CredentialsApi .getHintPickerIntent(googleApiClient, request); try { activity.startIntentSenderForResult(intent.getIntentSender(), REQUEST_PHONE_NUMBER_REQUEST_CODE, null, 0, 0, 0); } catch (IntentSender.SendIntentException e) { promiseReject(SEND_INTENT_ERROR_TYPE, SEND_INTENT_ERROR_MESSAGE); callAndResetListener(); } }