The TelephonyManager.getLine1Number() works on GSM phones, but not CDMA phones. Is it possible to get the phone number of a CDMA phone through android API calls at all? thanks
Asked
Active
Viewed 6,965 times
2 Answers
2
Although the method suggested might work, some carriers (I believe it's their choice) do not provide this number, returning null instead.
Returning null is stated in the documentation: http://developer.android.com/reference/android/telephony/TelephonyManager.html (scroll down to the method's documentation).
Here is a link for a possible work-around: http://code.google.com/p/android/issues/detail?id=1110#c5

Pedro Loureiro
- 11,436
- 2
- 31
- 37
0
I've successfully used the following on a Motorola Droid and HTC EVO 4G which are both CDMA.
TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
String phoneNumber = telephonyManager.getLine1Number();
Make sure you are requesting the correct permission in your manifest.
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

Brian
- 16,196
- 3
- 27
- 28
-
One of my users reports that he uses htc evo on sprint and this method doesn't work. – wangii Sep 12 '10 at 22:40
-
I've confirmed that this method works on a stock Sprint HTC EVO 4G running Android 2.2. – Brian Sep 15 '10 at 15:39
-
I think it depends on your provider, not the phone or the Android version whether this works. – Carsten May 11 '11 at 03:22