TelephonyManager.getLine1Number() returning null?

by David Given » Wed, 28 Apr 2010 21:28:29 GMT


Sponsored Links
 -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm trying to fetch the telephone number of the device. I'm calling
TelephonyManager.getLine1Number(), and it's returning null.

A trawl of the intertubes shows that there's a potential problem with
some SIMs not containing this information; however, Settings->About
Phone->Status *does* show the correct phone number, so this isn't it.

Looking at the code, it appears that Settings isn't using
TelephonyManager to retrieve the phone number. Instead it's using
com.android.internal.telephony.Phone, an internal API, to do this; so
obviously this is working, where TelephonyManager is not.

Can anyone shed any light on this, and hopefully suggest how I can
correctly fetch the phone number?

- -- 
€€  €€€€€  http://www.cowlark.com  €€€€€
life  .^3 4=+/,1 0 1 0 1}
--- Conway's Game Of Life, in one line of APL
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla -  http://enigmail.mozdev.org/ 

iEYEARECAAYFAkvYN9wACgkQf9E0noFvlzg6WwCgmyZDbGV1IqqnIUTUBxjtgmUZ
YL8An2mrVxtNy+i8kjeFniytTIY8UYvP
=6p5u
-----END PGP SIGNATURE-----

--



TelephonyManager.getLine1Number() returning null?

by David Given » Wed, 05 May 2010 18:53:49 GMT


 -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



[...]

Does anyone know anything about this?

- -- 
€€  €€€€€  http://www.cowlark.com  €€€€€
life  .^3 4=+/,1 0 1 0 1}
--- Conway's Game Of Life, in one line of APL
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla -  http://enigmail.mozdev.org/ 

iEYEARECAAYFAkvhTh0ACgkQf9E0noFvlzjo4ACfTvvkmZS+bx4qbSGdhFXe/Odw
UAcAoL/HYT59nnVL86s6sNymD6wlklEs
=MTvd
-----END PGP SIGNATURE-----

--


Sponsored Links


TelephonyManager.getLine1Number() returning null?

by Vinay S » Wed, 05 May 2010 19:32:34 GMT


 Hi David,

I think you are trying to use TelephonyManager.getLine1Number();

Instead create an object of the TelephonyManager and then call the
getLine1Number();

-Vinay




>



TelephonyManager.getLine1Number() returning null?

by Mark Ellul » Wed, 05 May 2010 19:48:57 GMT


 I was informed that its a SIM issue, and that some SIM cards do not
store the telephone number in the appropriate way to retrieve the
number





> >



TelephonyManager.getLine1Number() returning null?

by Vinay S » Thu, 06 May 2010 13:41:23 GMT


 Hi David,

Pl. try this code..

TelephonyManager tMgr = (TelephonyManager)
getSystemService(Context.TELEPHONY_SERVICE) ;
Log.d(""+tMgr.getLine1Number() ) ;

-Vinay





>



TelephonyManager.getLine1Number() returning null?

by Vinay S » Thu, 06 May 2010 13:48:25 GMT


 Hi,

Are you sure, you are getting the context correctly..?
Are you able to get other deatils, like Network type phone type, sim
status etc?

-Vinay





>



Other Threads

1. Should I use AlarmManager or ScheduledExecutorService? (pros/cons?)

Hello Everyone,

Here is my dilemma.  I have several different timed operations that I
need to run on a daily basis, but at different times.  Currently I am
using ScheduledExecutorService, however having dabbled with
AlarmManager and its setRepeating function, I'm wondering if I should
use that instead?  What are the pros and cons of using either of these
classes?

Cheers,
Charles
--~--~---------~--~----~------------~-------~--~----~

2. How to change image on focus and unfocus

How to chanage the image on focus and unfocus
--~--~---------~--~----~------------~-------~--~----~

3. How to store database information at common places.

4. Streaming in android

5. Smack & Android

6. Hp IPAQ h4350

7. No information about Android