A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
The Java EE 7 Tutorial Volume 1 or Volume 2
this week in the
jQuery UI in Action
how to get phone number from my app?
Joined: Feb 10, 2012
Mar 17, 2012 10:42:29
is it possible to retrieve my mobile number through my andriod app?
if so please suggest
Joined: Jul 25, 2011
Apr 06, 2012 05:21:51
The following code would do!. But be sure to insert Null Checks for the result.
phoneNo = ((TelephonyManager) getSystemService(TELEPHONY_SERVICE)).getLine1Number();
Also insert the following permission in AndroidManifest file.
Joined: Mar 12, 2008
May 04, 2012 03:13:31
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.
Joined: Jun 02, 2011
May 14, 2012 07:40:09
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
It is sorta covered in the
JavaRanch Style Guide
subject: how to get phone number from my app?
To get a number from html page
capturing windows app's output
How this app working?
Reflection got at field editing exception
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014