identity-samples icon indicating copy to clipboard operation
identity-samples copied to clipboard

Play Services Hint Request cannot display phone numbers

Open codingjeremy opened this issue 5 years ago • 27 comments

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!

codingjeremy avatar Sep 10 '19 20:09 codingjeremy

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.

codingjeremy avatar Sep 10 '19 20:09 codingjeremy

Comment by eygraber Tuesday Jul 17, 2018 at 03:39 GMT


I have the same issue :frowning_face:

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

codingjeremy avatar Sep 10 '19 20:09 codingjeremy

Comment by dalmendray Wednesday Oct 24, 2018 at 22:28 GMT


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.

codingjeremy avatar Sep 10 '19 20:09 codingjeremy

Comment by iam1492 Thursday Oct 25, 2018 at 02:18 GMT


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

codingjeremy avatar Sep 10 '19 20:09 codingjeremy

Comment by mesibo Friday Oct 26, 2018 at 14:16 GMT


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

codingjeremy avatar Sep 10 '19 20:09 codingjeremy

Comment by greenpeas Monday Nov 19, 2018 at 07:46 GMT


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

codingjeremy avatar Sep 10 '19 20:09 codingjeremy

Comment by behelit Monday Jan 21, 2019 at 00:56 GMT


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

codingjeremy avatar Sep 10 '19 20:09 codingjeremy

Comment by MadaoChan Monday Jan 21, 2019 at 02:34 GMT


Not work on

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

codingjeremy avatar Sep 10 '19 20:09 codingjeremy

Comment by foxware00 Tuesday Jan 29, 2019 at 14:36 GMT


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

codingjeremy avatar Sep 10 '19 20:09 codingjeremy

Comment by iam1492 Thursday Feb 07, 2019 at 06:23 GMT


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

codingjeremy avatar Sep 10 '19 20:09 codingjeremy

Comment by otopba Monday Aug 26, 2019 at 09:20 GMT


Same problems =/

codingjeremy avatar Sep 10 '19 20:09 codingjeremy

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.

codingjeremy avatar Sep 10 '19 20:09 codingjeremy

Doesn't work on Galaxy S10+ with Android 10

andzejsw avatar Feb 07 '20 09:02 andzejsw

Doesn't work on Mi 4

hardikamal avatar Jul 30 '20 08:07 hardikamal

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?

0x384c0 avatar Aug 07 '20 09:08 0x384c0

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

ridsync avatar Nov 10 '20 09:11 ridsync

Doesn't works on Redmi 9i android 10. Showing the same weird animation and pop up disappears..Has anyone found the sol?

introidx avatar Nov 28 '20 07:11 introidx

Same issue with Xiaomi Redmi 5 plus Did anyone find the ways?

AzizjonDekhkanov avatar Feb 15 '21 09:02 AzizjonDekhkanov

+1

nolimitdev avatar Jul 19 '21 08:07 nolimitdev

Any update here?

hardikamal avatar Aug 03 '21 07:08 hardikamal

Same issue with emulator, 王德发, any body solved this problem

OvenCroc avatar Aug 16 '21 05:08 OvenCroc

this the project working in Android 11 emulator https://github.com/introidx/phone-Selecter

but not working in device's:

Mi note
Vivo

the list of number dialog is not opening.

there is same issue in flipkart App: https://play.google.com/store/apps/details?id=com.flipkart.android&hl=en_IN&gl=US

krunalpatel3 avatar Sep 17 '21 11:09 krunalpatel3

My finding is that this feature is depended in SIM card of mobile operator. If mobile operator does not store cell phone number on the SIM this feature is not working - dialog which should show number appears and quickly disappear. If number is stored on SIM card this feature works well, but strange is that number is without international preset e.g. +4.. or 004.. so it is still not usable for me without country code. In my country there are 4 mobile operators and I tested SIM card each of them... and 2 of them stores number on the SIM card and other 2 does not store. Whether your operator stores number on the SIM you can easily test by android app SIM Card Info https://play.google.com/store/apps/details?id=me.harrygonzalez.simcardinfo Strange is that google does not explain this, several issues are reported at https://issuetracker.google.com/ but no mention from google that feature is dependent on SIM card of mobile operator.

nolimitdev avatar Sep 22 '21 20:09 nolimitdev

It is work for me, when a added phone number to my SIM-card at device settings. Realme 8 pro

Alexandrsneg avatar Feb 08 '22 06:02 Alexandrsneg

Sorry could you give more detail about how to add phone number to the sim card?

antoniodemarco85 avatar Sep 15 '23 14:09 antoniodemarco85

Screenshot_20230915-212253_1_1

nolimitdev avatar Sep 15 '23 19:09 nolimitdev

Any Update here?

Satish94922 avatar Oct 13 '23 09:10 Satish94922