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
Creating Custom Overlay on The Map
Android 4.4.2 - Java.Lang.Runtimeexception: Performing Stop of Activity That Is Not Resumed
How to Place App Icon on Launcher Home Screen
How to Use Standard Attribute Android:Text in My Custom View
Easier Way to Get View's Id (String) by Its Id (Int)
Package Signatures Do Not Match The Previously Installed Version
When Using Alertdialog.Builder with Edittext, The Soft Keyboard Doesn't Pop
Use 32-Bit Jni Libraries on 64-Bit Android
Change Actionbarsherlock Background Color
How to Take Pictures from The Camera Without Preview When My App Starts
How to Enable Internal App Sharing for Android
Move Snackbar Above The Bottom Bar
How to Get Background Color from Current Theme Programmatically
How to Make an Android View That Flips Between Views on Swipe/Fling
Should I Use Getapplicationcontext or Activity.This in a Long Running Asynctask