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.
Asked
Active
Viewed 432 times
0
-
Is the movile have more than one sim? – Narkha Mar 12 '14 at 08:50
-
TelephonyManager tMgr = (TelephonyManager) this .getSystemService(Context.TELEPHONY_SERVICE); String mPhoneNumber = tMgr.getLine1Number(); – Srikanth Mar 12 '14 at 08:50
-
@Narkha Yes we have dual sim – Jitendra Pareek Mar 12 '14 at 09:07
2 Answers
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.
-
These may fail several times..Do u have any other altrenative – Vishal Santharam Mar 12 '14 at 08:50
-
As I know there are no alternatives. Not all simcards allows to read MSISDN from them and in this case android api don't know it. – Alexander Mikhaylov Mar 12 '14 at 08:51
-
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