0

I want to fetch SIM phone number.

I have used TelephonyManager to get the same[with READ_PHONE_STATE permission] . I have tried for BSNL and JIO sim cards. I am getting phone number for JIO sim where as i am not getting for BSNL. Later i got to know that , API will give sim card number only if sim card contains Phone number.

I am using BHIM app and i tried to to UPI registration with BSNL sim and it works . Here my question is how BHIM app is getting and how they are trying to get the phone number and i have checked they are also using [READ_PHONE_STATE] permission to get the number(if i dont give this permission app fails to proceed)

Any other method(Other than READ_PHONE_STAE i.e telephonymanager) using which we can get the phone numbers of device

Some people are suggesting to use HintRequest phone selector API but i am getting some run time errors below code i tried

private void requestHint() {
    HintRequest hintRequest = new HintRequest.Builder()
       .setPhoneNumberIdentifierSupported(true)
       .build();

    PendingIntent intent = Auth.CredentialsApi.getHintPickerIntent(
        apiClient, hintRequest);
    startIntentSenderForResult(intent.getIntentSender(),
        RESOLVE_HINT, null, 0, 0, 0);
}
Vipul Prajapati
  • 1,183
  • 9
  • 11

0 Answers0