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. Eclipse not seeing ADT "tools" folder

Hello,
I'm on the last step of installing the android ADT plugin in Eclipse
3.4. However, when I go to Window > Preferences and try to point
Eclipse to my SDK tools folder I get the following error:  Could not
find folder 'tools' i...id-sdk-windows-1.0_r2\tools\'

I've tried everything. Any ideas?

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

2. how can i change the background color of ExpandlistActivity?

hi all,
    now i have a ExpandListActivity,now i want to change it's background color 
,when i change the color to "White",i can not see the font.just focus the item 
that can see it!why?

</:includetail>
--~--~---------~--~----~------------~-------~--~----~

3. Broken Gallery View? using Gallery.setSelection(int position, boolean animate)

4. Broken Gallery View? using Gallery.setSelection(int position, boolean animate)

5. Run two android instances on the same host and comunicate betwen them using socket

6. How to remove a contact with a specified phone number?

7. Install wlan asus eee