How to detect if device is capable of calling and messaging How to detect if device is capable of calling and messaging android android

How to detect if device is capable of calling and messaging


Using this technic you can test all sorts of things too e.g. compass, is location available

    PackageManager pm = getBaseContext().getPackageManager();    pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY);


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.


That should do it:

 PackageManager pm = this.getPackageManager(); if (pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {     System.out.println("horray"); } else {     System.out.println("nope"); }