Friday, 2 August 2013

Get Phone Number From Android

Hai guys after big gap again i am going to start my blogging..
Really i faced big problem with Phone number picking method in android. finally i came to its not possible.
because most of the network service provider will not store phone number in the SIM card.

if they stored number in Sim card  the following code will work..

TelephonyManager tm=(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
 mynumber=String.valueOf(tm.getLine1Number());



If you need any of the unique number from Sim means you may use Sim serial number..
The following code will guide you get Sim Serial Number

TelephonyManager tm=(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
String sim=String.valueOf(tm.getSimSerialNumber());

Another Method to retrieve phone number is we can get Phone number from Message Sent Items..
But its also not sure to get correct number..



No comments:

Post a Comment