How to check Phone calling service is enable or not in android device?

橙三吉。 提交于 2019-12-11 11:42:23

问题


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?


回答1:


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...




回答2:


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. 
}   


来源:https://stackoverflow.com/questions/15563893/how-to-check-phone-calling-service-is-enable-or-not-in-android-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!