It's not a secret anymore!*
The moose likes Android and the fly likes android how to obtain the phone number of the machine through the interface? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "android how to obtain the phone number of the machine through the interface?" Watch "android how to obtain the phone number of the machine through the interface?" New topic
Author

android how to obtain the phone number of the machine through the interface?

Regen Mark
Greenhorn

Joined: Mar 14, 2012
Posts: 6
android how to obtain the phone number of the machine through the interface?
anyone can help me?
Mohan Prasath
Ranch Hand

Joined: Jul 25, 2011
Posts: 38

Most of the time the following code would return null or your old SIM number. But it works some times

String phoneNo = ((TelephonyManager) getSystemService(TELEPHONY_SERVICE)).getLine1Number();

You have to give the following permission in the AndroidManifest <uses-permission android:name="android.permission.READ_PHONE_STATE"/>


With regards,
Mohan Prasath
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: android how to obtain the phone number of the machine through the interface?
 
Similar Threads
How to get the phone number of native for android?
How this app working?
Calls trough interface references are slower (on Android)
how install in Eclipse(Java/Android) emulator for Tablet PC Android
Android: Microsoft Exchange