private void requestHint() throws IntentSender.SendIntentException {
HintRequest hintRequest = new HintRequest.Builder()
.setPhoneNumberIdentifierSupported(true)
.build();
GoogleApiClient mGoogleApiClient = new GoogleApiClient.Builder(this)
.build();
PendingIntent intent = Auth.CredentialsApi.getHintPickerIntent(mGoogleApiClient , hintRequest);
startIntentSenderForResult(intent.getIntentSender(),
CREDENTIAL_PICKER_REQUEST, 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 == CREDENTIAL_PICKER_REQUEST) {
if (resultCode == RESULT_OK) {
Credential credential = data.getParcelableExtra(Credential.EXTRA_KEY);
textView.setText(credential.toString());
}
}
}
Asked
Active
Viewed 143 times
1

Frank van Puffelen
- 565,676
- 79
- 828
- 807

Kiran Kittu
- 45
- 6
-
That's the old way of signing in the user with Google. If you understand Kotlin, I think that this [article](https://medium.com/firebase-developers/how-to-authenticate-to-firebase-using-google-one-tap-in-jetpack-compose-60b30e621d0d) will help. Besides that, [onActivityResult is deprecated](https://stackoverflow.com/questions/62671106/onactivityresult-method-is-deprecated-what-is-the-alternative). – Alex Mamo May 29 '22 at 09:37