如何让一个机器人CDMA手机的电话号码?机器人、电话号码、手机、CDMA

2023-09-06 22:30:02 作者:后来的你喜欢了谁

在TelephonyManager.getLine1Number()适用于GSM手机,而不是CDMA手机。是否有可能得到一个CDMA手机通过在所有的Andr​​oid API调用的电话号码?谢谢

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