Detecting Whether or Not Device Support Phone Calls

Detecting whether or not device support phone calls?

The iPhone supports the tel:// URI scheme. So you could use:

[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"tel://"]];

canOpenURL: explicitly checks whether there's an application capable of opening that URL scheme, not that the URL is correct. So it doesn't matter that no phone number is specified. The method returns a BOOL, so check that for YES or NO.

That should literally answer whether there's any application present capable of making a telephone call. So it should be okay against any future changes in device segmentation.

Use jQuery to detect whether a device can make telephone calls (supports tel:// protocol)

I'm not sure about Android or BlackBerry, but iOS will automatically pick up telephone numbers and wrap them like so: <a href="tel:xxx">xxx</a>...so you could have a hidden <div> somewhere that contains a phone number like 1-800-555-5555, then, on page load do something like this:

var isTelephone = $("a[href*='tel:']").length > 0;

This may or may not be portable to other platforms, you'll have to try it out.

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 to tell if Cocoa Touch device can make calls?

You could query [[UIDevice currentDevice] model], and check if it is an iPhone.

Detecting voice call support in mobile devices using titanium

Unfortunately there is no way to detect device capabilities. But there are several workarounds depending on what you want to do:

  1. You can create a wrapping method, that tries to detect the phone capability: On iOS this is easy, only the iPhone is able to do voice calls. On Android it's a bit different. Usually only handhelds can do phone calls but their are also some tablet devices that are able to.
  2. If you simply want to present a phone number that the user can klick on you can create a link with Ti.Platform.openURL('callto:<number>');. There is also a canOpenURL() method - but its not available on android.

The canOpenURL() method would be useful especially for android to determine whether the system is able to do phone calls or not. This question was also dicussed on Appcelerator Q&A.

Conclusion: Detecting capabilities needs to be solved on your own. In one of my apps i used the second solution regardless the device is able to do phone calls.



Related Topics



Leave a reply



Submit