Search code examples
titanium-mobileappcelerator-mobile

Detecting voice call support in mobile devices using titanium


However, not all mobile devices support phone calls, such as the iPad.

How can I programmatically determine whether a device supports voice calling or not using titanium?


Solution

  • 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.