Play Services Hint Request cannot display phone numbers
See original GitHub issueIssue by iam1492 Wednesday Apr 11, 2018 at 15:19 GMT _Originally opened as https://github.com/googlesamples/android-credentials/issues/27_
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!
Issue Analytics
- State:
- Created 4 years ago
- Comments:24
Top GitHub Comments
At least how do we know that phone numbers could not be found on device before calling
startIntentSenderForResult
, so we could avoid that animation with empty box?Doesn’t work on Galaxy S10+ with Android 10