This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

how to get phone number from my app?  RSS feed

 
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
is it possible to retrieve my mobile number through my andriod app?
if so please suggest
 
Ranch Hand
Posts: 38
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following code would do!. But be sure to insert Null Checks for the result.

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

Also insert the following permission in AndroidManifest file.

<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
 
Ranch Hand
Posts: 78
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I have used the same and in emulator it shows one 9 digit number . In android phone application crashes and shows "The application(process xxx.xxx.xxx) has stopped unexpectedly. please try again.


Any solution would be greatly appreciated.

Thanks,
 
Ranch Hand
Posts: 95
C++ Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Yeah, the one by Mohan Prasath will work. It would not work on an emulator because it does not support any sort of wireless connectivity. It would work on your phone
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!