How can I tell if a device can run system.openURL("tel:")

Is there any way to check a system parameter to see if the device my app is running on is capable of making phone calls? The API page for system.openURL(“tel:”) does not mention any such option but I think it would make sense to check first before attempting the call. Any insights? 

Thanks much for your help. Regards,

Kerem

Maybe there is a better way, but for Android  ‘deviceID’ has some hints: http://docs.coronalabs.com/api/library/system/getInfo.html#deviceid

Then maybe for iOS check if ‘model’ returns ‘iphone’?

Better option could be native.canShowPopup(“sms”)

Great idea! Thanks much. This is much better than checking names since there will always be names you miss in the 5000+ devices on Android camp and then there is the issue of new devices getting released. Will try and let you know but see no reason it shouldn’t work.

Edit - Seems to work well. Thanks once again.

Hmm, I guess I jumped too soon. Seems like native.canShowPopup(“sms”) returns true on iPad since iPad can run Messages app and send iMessages which probably trick the API. Not sure if any Android tablets will fall this way. More checking needed. 

In the meanwhile, if anyone knows of an easier way to tell if a device can make phone calls or not I would really appreciate to find out about it. Thank you so much!!!

Ok. On Android it seems like the native.canShowPopup(“sms”) call on an Android tablet returns false so we’re probably good there. I used the system.getInfo(“model”) to weed out the iPads so now I seem to be able to detect iPhones and Android Phones pretty accurately. All good for now. 

local isPhone = ( ( string.sub( system.getInfo("architectureInfo"), 1, 6 ) == "iPhone" ) and (system.getInfo("platformName") == "iPhone OS") ) or ( (system.getInfo("platformName") == "Android") and (native.canShowPopup("sms") == true) )

Yup. Thats exactly the way to go. Thanks much for sharing.

Maybe there is a better way, but for Android  ‘deviceID’ has some hints: http://docs.coronalabs.com/api/library/system/getInfo.html#deviceid

Then maybe for iOS check if ‘model’ returns ‘iphone’?

Better option could be native.canShowPopup(“sms”)

Great idea! Thanks much. This is much better than checking names since there will always be names you miss in the 5000+ devices on Android camp and then there is the issue of new devices getting released. Will try and let you know but see no reason it shouldn’t work.

Edit - Seems to work well. Thanks once again.

Hmm, I guess I jumped too soon. Seems like native.canShowPopup(“sms”) returns true on iPad since iPad can run Messages app and send iMessages which probably trick the API. Not sure if any Android tablets will fall this way. More checking needed. 

In the meanwhile, if anyone knows of an easier way to tell if a device can make phone calls or not I would really appreciate to find out about it. Thank you so much!!!

Ok. On Android it seems like the native.canShowPopup(“sms”) call on an Android tablet returns false so we’re probably good there. I used the system.getInfo(“model”) to weed out the iPads so now I seem to be able to detect iPhones and Android Phones pretty accurately. All good for now. 

local isPhone = ( ( string.sub( system.getInfo("architectureInfo"), 1, 6 ) == "iPhone" ) and (system.getInfo("platformName") == "iPhone OS") ) or ( (system.getInfo("platformName") == "Android") and (native.canShowPopup("sms") == true) )

Yup. Thats exactly the way to go. Thanks much for sharing.