Satyam
Satyam

Reputation: 15894

iphone - Check whether call can be placed or not

I googled a lot and found that its not possible to find whether operator's signal is present or not. But is there valid API to find whether I can place a call or not?

Upvotes: 1

Views: 302

Answers (2)

joshpaul
joshpaul

Reputation: 953

I'm not aware of any method to determine the carrier signal. If all else fails, there's likely a hackish way to do it by grabbing a screenshot and analyzing the upper-left corner. That said...

You might want to dig into CoreTelephony, as there might be something in there. [CTCall callState]? (I'm not familiar enough with it to say...).

To find out if the the telephone URL can be used (i.e. tel:8005551212):

if ([[UIApplication sharedApplication: canOpenURL:telURL])
{
    // your code here
}

This will at least help determine if the user's on a phone capable device.

Using openURL: will return YES, even when in Airplane Mode.

Upvotes: 1

Paul Ardeleanu
Paul Ardeleanu

Reputation: 6700

I don't think you can check if the operator signal is present but you can check if you can actually place a call:

NSURL *phoneNumberURL = [NSURL URLWithString:@"tel://004412345"];
if([[UIApplication sharedApplication] openURL:phoneNumberURL] == YES) {
  ...
}

Upvotes: 0

Related Questions