When using the code from google's sms retriever api to first grab the device's phone number, the dialog is shown with a loading spinner, then quickly disappears. In onActivityResult, the resultCode is 1002 and the intent is empty. No documentation for this error code exists. The exact code I'm using is
email.setOnClickListener(v -> {
HintRequest hintRequest = new HintRequest.Builder().setHintPickerConfig(new CredentialPickerConfig.Builder().setPrompt(0).build())
.setPhoneNumberIdentifierSupported(true)
.setEmailAddressIdentifierSupported(false)
//.setAccountTypes(IdentityProviders.GOOGLE)
.build();
PendingIntent intent =
Auth.CredentialsApi.getHintPickerIntent(mGoogleApiClient, hintRequest);
try {
startIntentSenderForResult(intent.getIntentSender(),599,null,0,0,0,null);
} catch (IntentSender.SendIntentException e) {
Log.e("create", "Could not start hint picker Intent", e);
}
});
mGoogleApiClient = new GoogleApiClient.Builder(getContext())
.enableAutoManage(getActivity(),connectionResult -> {
Timber.e("conenction failed");
})
.addApi(Auth.CREDENTIALS_API)
.addApi(Auth.GOOGLE_SIGN_IN_API)
.build();
If I were to set as true EmailAddressIdentifiedSupported OR even just uncomment setAccountTypes, then the hint request would function correctly showing email accounts and returning the name and email to the app, but enabling both does not cause the credential id to be the phone number as in 1
This is being called from a fragment, but calling every variety of startIntentSenderForResult from any location makes no difference.
The Phone Number Hint API, a library powered by Google Play services, provides a frictionless way to show a user's (SIM-based) phone numbers as a hint. The benefits to using Phone Number Hint include the following: No additional permission requests are needed.
Google sends a Hint Request message (root element is <HintRequest> ) that contains the time it last received an update from your server. Your server responds with a Hint Response message ( <Hint> ) that lists the hotels whose prices have changed since that time. Google then responds with a Query message ( <Query> ).
The HintRequest api provided by google has not fully accomplished its feature and is quite buggy , Its works fine in google devices as said by developers "OEM issue that their pixel or nexus phone working well."
https://issuetracker.google.com/issues/77884951 .
https://github.com/googlesamples/android-credentials/issues/27
Many apps are still using it with handling the exceptional cases with own logic such as myntra verify number feature which is there on the profile page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With