Does your G1 display the correct line number through settings?
(Settings > About phone > Status > Phone Number)

This method used by the system seems to always be accurate, but I
believe it is a private API;

// Snippit from
http://android.git.kernel.org/?p=platform/packages/apps/Settings.git;a=blob_plain;f=src/com/android/settings/deviceinfo/Status.java;hb=HEAD

import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;

...

Phone mPhone = PhoneFactory.getDefaultPhone();

...

setSummaryText("number", mPhone.getLine1Number());

// End snippit



On Apr 10, 7:56 am, Mark Murphy <[email protected]> wrote:
> Muthu Ramadoss wrote:
> > Is there a way to look up the user phone number other than TelephonyManager?
>
> > In my G1, this returns null:
>
> > // get your phone number
> >         TelephonyManager telephonyManager = (TelephonyManager)
> >                 getSystemService(Context.TELEPHONY_SERVICE);
> >         String tel = telephonyManager.getLine1Number();
>
> >         Log.i("Telephone Number ==> ", tel+" <==");
>
> Not only does this apparently return null in some cases (like you got),
> it does not have to necessarily return a valid value.
>
> I tried your code, and I get a phone number that I *think* is what I was
> originally assigned when I bought the G1, before my other T-Mobile
> number could be ported over.
>
> So I am not certain this method is reliable in any case.
>
> > Is there any other way of getting user's own phone number?
>
> Hopefully yes, though I don't know of one...
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android App Developer Books:http://commonsware.com/books.html
--~--~---------~--~----~------------~-------~--~----~
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