0

I want to get Sim Card Mobile number of the device which use my App. I have number of answer but there not perfect code. Please Give me supporting link or code to use in my android app.

MAC
  • 15,799
  • 8
  • 54
  • 95
Jitendra Pareek
  • 627
  • 7
  • 28

2 Answers2

0
TelephonyManager telemamanger = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String getSimNumber = telemamanger.getLine1Number();

You will also need to add this permission in AndroidManifeast.xml

<uses-permission android:name="android.permission.READ_PHONE_STATE"/>

The documentation for TelephonyManager.getLine1Number() says this method will return null if the number is "unavailable", but it does not say when the number might be unavailable.

ThomasRS
  • 8,215
  • 5
  • 33
  • 48
MAC
  • 15,799
  • 8
  • 54
  • 95
0

Earlier I was trying to achieve this. It mostly depend on the simcard provider. Like Airtel(India) does not allow mobile number to be identifed through code but if you try Aircel it do provide phone number.

W00di
  • 954
  • 12
  • 21