Click here to Skip to main content
15,901,368 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
I have used this below code

TelephonyManager tm=(TelephonyManager)getActivity().getSystemService(Context.TELEPHONY_SERVICE);
String number = tm.getLine1Number();



but it is only providing mobile no. if the mobile number is stored in sim or in phone.
Posted
Updated 3-Jan-16 22:34pm
v2
Comments
ridoy 4-Jan-16 3:02am    
I don't get you! you are using code to find out sim no, right? so what do you mean by number isn't saved?
Tara_Singh_ Danu 4-Jan-16 4:34am    
No i want to get the mobile no.,the above code will only work if mobile no. is stored in sim
Richard MacCutchan 4-Jan-16 5:40am    
If the number is not stored then there is no way you can get it. But also, if it is not stored the phone will not work.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900