android / identity-samples

Multiple samples showing the best practices in identity on Android.
Apache License 2.0
380 stars 227 forks source link

Play Services Hint Request cannot display phone numbers #6

Open codingjeremy opened 5 years ago

codingjeremy commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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,

codingjeremy commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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


Not work on

codingjeremy commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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


Same problems =/

codingjeremy commented 5 years ago

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.

andzejsw commented 4 years ago

Doesn't work on Galaxy S10+ with Android 10

hardikamal commented 4 years ago

Doesn't work on Mi 4

0x384c0 commented 4 years ago

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?

ridsync commented 4 years ago

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

introidx commented 3 years ago

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

AzizjonDekhkanov commented 3 years ago

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

nolimitdev commented 3 years ago

+1

hardikamal commented 3 years ago

Any update here?

OvenCroc commented 3 years ago

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

krunalpatel3 commented 3 years ago

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

nolimitdev commented 3 years ago

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.

Alexandrsneg commented 2 years ago

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

antoniodemarco85 commented 1 year ago

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

nolimitdev commented 1 year ago

Screenshot_20230915-212253_1_1

Satish94922 commented 1 year ago

Any Update here?