如何获取Android CDMA手机的电话号码?

问题描述:

TelephonyManager.getLine1Number() 适用于 GSM 手机,但不适用于 CDMA 手机.是否可以通过android API调用获取CDMA手机的电话号码?谢谢

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

我已经成功地在摩托罗拉 Droid 和 HTC EVO 4G 上使用了以下内容,它们都是 CDMA.

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" />