Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting whether or not device support phone calls?

Is the below code reliable to be used to determine whether a device can support phone calls or not? My concern is if apple changes the iphone string to anything else let's say they decide to have "iphone 3g", "iphone 4" etc.

[[UIDevice currentDevice].model isEqualToString:@"iPhone"] 
like image 396
aryaxt Avatar asked Feb 23 '11 18:02

aryaxt


People also ask

Can I make phone calls from this device?

You can make phone calls from the Phone app and other apps or widgets that show your contacts. Wherever you see a phone number, you can usually tap it to dial. You may be able to tap underlined phone numbers in Google Chrome to copy the number to the dialpad.

What is call on other devices?

Calls on Other Devices allows other linked devices to relay calls via the iPhone to the phone network. The iPhone must be nearby, turned on, and connected to Wi-Fi, as do the other devices placing calls via the iPhone.


1 Answers

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.

like image 175
Tommy Avatar answered Sep 30 '22 04:09

Tommy