android-credentials icon indicating copy to clipboard operation
android-credentials copied to clipboard

Play Services Hint Request cannot display phone numbers

Open iam1492 opened this issue 8 years ago • 13 comments

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!

iam1492 avatar Apr 11 '18 15:04 iam1492

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.

Kishiko avatar Jul 05 '18 11:07 Kishiko

I have the same issue :frowning_face:

@Kishiko where do you set the phone number on the device?

eygraber avatar Jul 17 '18 03:07 eygraber

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.

ikedm avatar Oct 24 '18 22:10 ikedm

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. :(

iam1492 avatar Oct 25 '18 02:10 iam1492

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

mesibo avatar Oct 26 '18 14:10 mesibo

I also had that same issue "showing empty dialog and disappearing quickly with sliding animation."

greenpeas avatar Nov 19 '18 07:11 greenpeas

Works on Galaxy Note 8 (8.0.0) Does not work on Sony Z2 (6.0.1) Does NOT work on Pixel -> LOL (9)

behelit avatar Jan 21 '19 00:01 behelit

Not work on

  • One Plus 5T (H2OS, 8.1.0)
  • Samsung SM-G570Y(8.0.0)
  • Samsung S7 edge(8.0.0)

MadaoChan avatar Jan 21 '19 02:01 MadaoChan

I have two Pixel 3XL both running Pie (9.0.0) and it works perfectly on one, and fails every time on the other

foxware00 avatar Jan 29 '19 14:01 foxware00

Need help :) Please Vote to this issue: https://issuetracker.google.com/issues/123654951

iam1492 avatar Feb 07 '19 06:02 iam1492

Same problems =/

otopba avatar Aug 26 '19 09:08 otopba

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

jiurchuk avatar Sep 09 '19 20:09 jiurchuk

I am closing this issue/PR, as it has been migrated to the new repo linked above in the comments. Thank you!

codingjeremy avatar Sep 10 '19 21:09 codingjeremy