Android Device Phone Call Ability

Android Device phone call ability

if (((TelephonyManager)getContext().getSystemService(Context.TELEPHONY_SERVICE)).getPhoneType()
== TelephonyManager.PHONE_TYPE_NONE)
{
// no phone
}

EDIT I'm surprised it comes back PHONE_TYPE_CDMA. Here's another possibility:

if (((TelephonyManager)getContext().getSystemService(Context.TELEPHONY_SERVICE)).getLine1Number()
== null)
{
// no phone
}

This will require the READ_PHONE_STATE permission.

How to detect if device is capable of calling and messaging

Maybe you can query the PackageManager whether the system contains any component that can respond to ACTION_CALL and ACTION_SENDTO intents? You might need to add the "tel:" and "smsto:" scheme in the URI.

How can I know the android tablet device can use telephony or not?

It may be a duplicate and very well answered here, including the case where the user has installed an app that can make phone calls regardless of the ability of the device itself (e.g. Skype):
Android Device phone call ability

How to reliably determine user's capability to call or SMS

(TelephonyManager tm=(TelephonyManager )this.getSystemService(Context.TELEPHONY_SERVICE);

I don't know why above code is returning false positive, but why don't you check its network type or network operator with telephony manager? For example, it might be returning NETWORK_TYPE_UNKNOWN flag for nexus 7.

return (android.telephony.TelephonyManager.getNetworkType()
!= android.telephony.TelephonyManager.NETWORK_TYPE_UNKNOWN)

Refernce:

  • http://developer.android.com/reference/android/telephony/TelephonyManager.html#getNetworkType()

  • http://developer.android.com/reference/android/telephony/TelephonyManager.html#getNetworkOperator()



Related Topics



Leave a reply



Submit