Android How to check device/tablet support calling functionality

android

Solution

By using TelephonyManager class, you can tell the availability of phone network as well as you can check for different related state of phone network.

TelephonyManager tm= (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
       if(tm.getPhoneType()==TelephonyManager.PHONE_TYPE_NONE){
        //No calling functionality
       }
       else
       {
       //calling functionality
       }

Hope This Helps

Problem

In my app there is a calling functionality. On click of "Call" button, app will launch the phone dialer with phone number. Now if any of the device/tablet is not having the calling functionality, in that case i want to check this ``` if(isSupportCalling) //launch dialer else //show message ``` inorder to avoid any application crash. As this permission will only allow android play to make it visible and able to download/install the app on device/tablet which don't support calling functionality. ``` <uses-feature android:name="android.hardware.telephony" android:required="false"/> ``` As i had seen very few threads on SO related to this, but didn't find a reliable way to this.

Original source