identity-samples: Play Services Hint Request cannot display phone numbers

Issue 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!

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 27 (12 by maintainers)

Most upvoted 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

Doesn’t work on Galaxy Note10+ with Android 10 resultcode is ACTIVITY_RESULT_NO_HINTS_AVAILABLE i want to get device’s Phone number . plz… LOL

Comment by jiurchuk Monday Sep 09, 2019 at 20:43 GMT


Happening also in Google Pixel XL running Android 10 and having Phone Number associated in my Google Account.

Comment by Kishiko Thursday Jul 05, 2018 at 11:55 GMT


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.