androidapicdma

How to get phone number of an android CDMA phone?


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


Solution

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