-->

Smart Lock sign-in hint setPhoneNumberIdentifierSu

2019-05-31 07:27发布

问题:

I am trying to get user phone number with a HintRequest

PendingIntent intent = Auth.CredentialsApi.getHintPickerIntent(
        googleApiClient, new HintRequest.Builder()
                .setPhoneNumberIdentifierSupported(true)
                .setEmailAddressIdentifierSupported(false)
                .build());
        try {
    startIntentSenderForResult(intent.getIntentSender(),
            REQUEST_CODE_RESOLVE_PHONE, null, 0, 0, 0);
} catch (IntentSender.SendIntentException e) {
    e.printStackTrace();
}

But getting no results and Activity.RESULT_CANCELED.

The nubmer is visible in Settings -> About -> Status -> SIM status and can be received through TelephonyManager, but I would like to get it without requesting the phone permission.

回答1:

Turned out it was a sim card problem, didn't work with EE sim