How to check Phone calling service is enable or no

2019-08-02 08:58发布

I want to know that how to check that phone call service is enable or not in different devices, i have Micromax Funbook(p300) Tablet(Android 4.0.3), in which there is no calling service, and i am using below code to check that

TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);   
if (tm.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE) {
    Log.v("TAG", "No calling service");
}else{
    Log.v("TAG", "calling service");
}

but this is not working. it always gives message calling service only.

Any help?

2条回答
ゆ 、 Hurt°
2楼-- · 2019-08-02 09:32

If calling service is not supported by tablet, google play won't allow the app to be installed on that tablet. Google Play internally checks for permissions which are supported by your device and the permissions the app is asking for, if they do not match, the app is shown as not compatible with your device. EDIT: Hence of course, you do not need to check if calling is supported by that device or not...

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-08-02 09:42

Try this, if device doesn't have facility to make voice call then it must not be a phone.

TelephonyManager tm = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
String ableToMakePhoneCalls = tm.getVoiceMailNumber(); 

//check device for voicemail number (null means no voicemail number).
if(ableToMakePhoneCalls == null)
{ 
     //If the device does not have voicemail, then it must not be a phone. So it can't call. 
}   
查看更多
登录 后发表回答