Are there alternate ways to look up user phone number when TelephonyManager returns null?

by Muthu Ramadoss » Fri, 10 Apr 2009 16:15:15 GMT


Sponsored Links
 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+" <==");


Is there any other way of getting user's own phone number?

take care,
Muthu Ramadoss.

 http://linkedin.com/in/tellibitz 
 http://androidrocks.googlecode.com  - Android Consulting.

Emo Philips < http://www.brainyquote.com/quotes/authors/e/emo_philips.html> ;
- "A computer once beat me at chess, but it was no match for me at
kick
boxing."

--~--~---------~--~----~------------~-------~--~----~



Are there alternate ways to look up user phone number when TelephonyManager returns null?

by Mark Murphy » Fri, 10 Apr 2009 19:56:17 GMT


 


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.


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 

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Are there alternate ways to look up user phone number when TelephonyManager returns null?

by strazzere » Fri, 10 Apr 2009 23:08:09 GMT


 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







--~--~---------~--~----~------------~-------~--~----~



Are there alternate ways to look up user phone number when TelephonyManager returns null?

by Muthu Ramadoss » Fri, 10 Apr 2009 23:22:22 GMT


 My G1 says "Unknown" when (Settings > About phone > Status > Phone
Number)

I haven't tried your new code snippet. I'll report back with the
results. Thanks.





--~--~---------~--~----~------------~-------~--~----~



Are there alternate ways to look up user phone number when TelephonyManager returns null?

by strazzere » Sat, 11 Apr 2009 00:45:43 GMT


 What type of phone are you using? Does it have a simcard and/or work
on your carrier network?

If the About phone/Status is not showing, then I doubt the snippit
would work even if you could compile it (your not going to be able to
using the standard SDK)






--~--~---------~--~----~------------~-------~--~----~



Are there alternate ways to look up user phone number when TelephonyManager returns null?

by Muthu Ramadoss » Sat, 11 Apr 2009 14:24:14 GMT


 I have an ADP1 bought from market that I use with a local GSM carrier
in Chennai. The phone works perfectly, although we use only GPRS and
not 3G.

But the phone number is always displayed as "Unknown".








--~--~---------~--~----~------------~-------~--~----~



Are there alternate ways to look up user phone number when TelephonyManager returns null?

by Edward Falk » Sun, 12 Apr 2009 00:47:16 GMT


 I encountered the same issue with a new Sim card I bought from the T-
Mobile store.  In a couple weeks, it started returning the correct
phone number, but it initially returned null.  I modified my software
to allow the user to enter the phone number if I couldn't find it from
the telephony manager.
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. how to merge column of a table

Hi,
I have a table which has four columns as say (RoomId, RoomName,
SwitchID, SwitchName.)
Now I want to merge last three columns depending upon first column(i.e
RoomID)

means supppose in a table I have following data

1:BedRoom:1:AC
1:BedRoom:2:CFL
1:BedRoom:3:Tube
2:Guest Room:4:cooler
2:Guest Room:5:Bulb
3:Kitchen:6:CFL
3::Kitchen:7:Fan
3:::Kitchen:8:TV
1::BedRoom:9:cooler
4:Guest Room:10:cooler
5:Study Room:11:AC
5:Study Room:12:Tube
2::Guest Room:13:Bulb

Now what I want is depending upon first column (i.e RoomID) other
column must have to be merge and therefore data will be like this

1:BedRoom:1:AC:2:CFL:3:Tube:9:cooler

How it is do?

Thanks

-- 

2. Q: How to do an expand animation?

Hi,

please consider the following. I have two containers and in between them I
want to expand/grow a third container that should show some temporary
information. The undo message in the Gmail app is an example for that. It
expands between the status bar and the body of the list, thereby pushing the
list down.

How would you implement that? I place the third/new container in my layout.
Then I need to make it visible before I start the animation, because
otherwise I wouldn't see it. However then in the parent there will be a gap
for the third component right away and the gap will have the full size (the
calculated/measured size) right away. Hence when I then start the animation
to scaleY from "0.0" to "1.0" I first see the complete space of the
underlying container and then slowly the actual component appears ;( What I
want is that space growing with the animation.

Any ideas? Do I need to set the height to 0 first and then measure myself to
define the goal height/Y of the animation as well as to set the component's
height myself after the animation is done?  Do you know a code sample that
does that?

Cheers,
Mariano

-- 

3. android edittext

4. Slow execution getThumbnail in HTC hero

5. Accessing style items by style ID

6. "Local" Service vs "Remote" Service

7. Protocol family for Bluetooth socket