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
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
I've successfully used the following on a Motorola Droid and HTC EVO 4G which are both CDMA.
Make sure you are requesting the correct permission in your manifest.
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