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. Encrypting application data file that is bundled with apk !





Since the decryption algorithm and key would have to be part of your apk as
well, someone could conceivably decompile your app and get all the
information they need to decrypt the data. So you can't make it 100% secure,
you can only make it less convenient for  someone trying to get the data.

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

2. Building Secure Android Applications

I imagine the following may be of interest to some of the members of  
this mailing list.


Prof. Patrick McDaniel and myself will be giving a 6 hour tutorial on  
building secure Android applications at the 2009 USENIX Annual  
Technical Conference held in San Diego, CA on Tuesday June 16th, 2009.  
More information on this tutorial can be found at the following URL.


http://www.usenix.org/events/usenix09/training/tutonefile.html#t5

We will also be giving the tutorial at the 18th USENIX Security  
Symposium held in Montreal, Canada. The conference is the week of  
August 10th, 2009. I believe our tutorial will also be on the 10th.


Thanks,

-Will

--
William Enck
PhD Candidate
Department of Computer Science and Engineering
The Pennsylvania State University
e...@cse.psu.edu

3. Map view not displaying tiles in 1.5 but it's fine in 1.1

4. creating a dialog that slides in

5. Development versions of proprietary Google applications

6. Can I close automatically the browser when I use it to start another activity ?

7. How can I send SMS or call on CDMA