Skip to content

Instantly share code, notes, and snippets.

@pratheepchowdhary
Created March 9, 2019 08:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pratheepchowdhary/d0a7c350669c9732ca33be3f4ac119d2 to your computer and use it in GitHub Desktop.
Save pratheepchowdhary/d0a7c350669c9732ca33be3f4ac119d2 to your computer and use it in GitHub Desktop.
// Construct a request for phone numbers and show the picker
private void requestHint() {
HintRequest hintRequest = new HintRequest.Builder()
.setPhoneNumberIdentifierSupported(true)
.build();
PendingIntent intent = Auth.CredentialsApi.getHintPickerIntent(
apiClient, hintRequest);
startIntentSenderForResult(intent.getIntentSender(),
RESOLVE_HINT, null, 0, 0, 0);
}
// Obtain the phone number from the result
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RESOLVE_HINT) {
if (resultCode == RESULT_OK) {
Credential credential = data.getParcelableExtra(Credential.EXTRA_KEY);
// credential.getId(); <-- will need to process phone number string
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment