Play Services Hint Request cannot display phone numbers
When I trying to retrieve phone number with Credentials api some device failed to showing phone number picker dialog and just showing empty dialog and the dialog disappear quickly with sliding animation.
Below is my code sample. (And I also tried with google sample)
val hintRequest = HintRequest.Builder()
.setPhoneNumberIdentifierSupported(true)
.setEmailAddressIdentifierSupported(false)
.build()
val options = CredentialsOptions.Builder()
.forceEnableSaveDialog()
.build()
val pendingIntent = Credentials.getClient(this, options).getHintPickerIntent(hintRequest)
startIntentSenderForResult(pendingIntent.intentSender, PHONE_REQUEST, null, 0, 0, 0)
and OnActivityResult
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == PHONE_REQUEST) {
if (data != null) {
val credential: Credential? = data.getParcelableExtra(Credential.EXTRA_KEY)
val phoneNumber = credential?.id
// Some of our device fail to get phoneNumber here.
}
}
}
In this case, empty popup showed up and disappear quickly with weird animation. And no value returned in onActivityResult callback. Even if it fails, popup will not appear and developer should know before popup is showing. If developer can know this will happen earlier, developer can do alternative way. For example, make user type their phone number manually. This issue is not related with Android version. Brand new phone or old phone have same issue and might be related with SIM card.(I guess..) I saw this bug on Samsung galaxy S7, S9.(one of S9 phone we have works fine but the other not)
Thanks!
I also had that same issue "showing empty dialog and disappearing quickly with sliding animation." I had overcome it by setting at least one phone number on my device, in the parameters.
I have the same issue :frowning_face:
@Kishiko where do you set the phone number on the device?
Has anyone found a solution for this? I want to know before trying to show the dialog that there's no phone number to show. It looks weird to the user the animation of the dialog showing and disappearing instantly because no phone numbers were found in the device.
I tried to open the issue from Android Issue Tracker. https://issuetracker.google.com/issues/77884951 But they said this is OEM issue that their pixel or nexus phone working well. They made buggy api and do not trying to correct it. Most people use non google device. :(
We are facing the same issue, works on some devices, not on others.
For example,
- Works fine on Asus phone running Oreo 8.1.0
- Not working on LG G6 running Oreo 8.0.0 - error is ACTIVITY_RESULT_NO_HINTS_AVAILABLE
I also had that same issue "showing empty dialog and disappearing quickly with sliding animation."
Works on Galaxy Note 8 (8.0.0) Does not work on Sony Z2 (6.0.1) Does NOT work on Pixel -> LOL (9)
Not work on
- One Plus 5T (H2OS, 8.1.0)
- Samsung SM-G570Y(8.0.0)
- Samsung S7 edge(8.0.0)
I have two Pixel 3XL both running Pie (9.0.0) and it works perfectly on one, and fails every time on the other
Need help :) Please Vote to this issue: https://issuetracker.google.com/issues/123654951
Same problems =/
Happening also in Google Pixel XL running Android 10 and having Phone Number associated in my Google Account.
I am closing this issue/PR, as it has been migrated to the new repo linked above in the comments. Thank you!