FORUMS

[GSM]Getting phone number programmatically

342 posts
Thanks Meter: 470
 
Post Reply Subscribe to Thread Email Thread
hi
i am writing an app that needs to get sim cards phone number.
i tried this but its not working.
Code:
        TelephonyManager telemamanger = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
        String getSimSerialNumber = telemamanger.getLine1Number();
it returns null....
i have tried every thing but nothing worked.
any help?
Last edited by poria1999; 18th April 2014 at 02:05 PM.
 
 
6th May 2014, 09:31 AM |#2  
Junior Member
Thanks Meter: 6
 
More
Quote:
Originally Posted by poria1999

hi
i am writing an app that needs to get sim cards phone number.
i tried this but its not working.

Code:
        TelephonyManager telemamanger = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
        String getSimSerialNumber = telemamanger.getLine1Number();
it returns null....
i have tried every thing but nothing worked.
any help?


It should work, however there is no guarantee that phone number is physically stored on a SIM-card or broadcasted from the network to the phone.
Alternative solution might be to ask the user to enter phone number manually in case if telemamanger.getLine1Number() returns null.
The Following User Says Thank You to GRYMALA For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools
Display Modes