Sujay Krishna Suresh wrote:
> 
> Hi guys,
>                   i'm using the foll code snippet in my program to
> display the user's phone number... 
>   TelephonyManager tm = (TelephonyManager)
> getSystemService(TELEPHONY_SERVICE);
>   phNoText.setText("You are : " + tm.getLine1Number());
> i'm getting a no in the emulator... but when i try runnin on the G1 it
> always returns a null string...
> am i doin something wrong or is it bec G1 doesnt give my app the phno???

That technique is unreliable, at least through Android 1.1. On my G1,
for example, getLine1Number() returns the phone number that my SIM was
originally set for, before I ported an existing mobile number over to my
account. Others have reported null values. My assumption is that this is
a SIM-specific issue.

I am not aware of a perfect solution to get the device's true phone number.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 2.0 Available!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to