Thursday, October 17, 2013

How to check support for Call & SMS on Android device?

Sometime we have requirements to implement call & sms support with in our android app. Now how to check whether device has support for call & sms feature. To verify, we can check the device phone type, which indicates the type of radio used to transmit voice calls. In addtion to this we can also check that the device has a telephony radio with data communication support or not. The method is as follows:-

public static boolean supportCallAndSMS(Context context) {
boolean isSupported = false;
TelephonyManager telephonyManager = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
boolean isPhone = !(telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE);
boolean featureTelephony = context.getPackageManager().hasSystemFeature(
PackageManager.FEATURE_TELEPHONY);
if(isPhone && featureTelephony) {
isSupported = true;
}
return isSupported;
}