Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically making an emergency call on iPhone

I'd like to make a button with which the user can dial through to emergency services.

There doesn't seem to be any specific method to call to do this, so I think I have to use

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];

and assign the phoneNumber myself. However, while I know this is 911 in the US, 999 in England, etc I'm not sure how to determine what country the user is in - I can retrieve their locale, but if they set their locale manually or travel outside their country, it wouldn't be reliable. I can resolve their location, but it won't work if they've turned off GPS or don't have internet connectivity.

I've heard 112 is now a universal standard on GSM phones - will it work on all iPhones?

like image 878
Toby Avatar asked May 13 '12 16:05

Toby


People also ask

How do you trigger an emergency call?

On your phone, open the Settings app. Emergency SOS. Turn Use Emergency SOS on. You can also turn Play alarm sound on to play a loud sound when Emergency SOS is starting.

Can you program 911 calls on iPhone?

Go to Settings > Emergency SOS, then turn on Call with 5 Presses. On other iPhone models: Press the side button five times, then drag the Emergency SOS slider.

What is emergency bypass iPhone?

Allow calls from emergency contacts when notifications are silenced. You can allow sounds and vibrations from emergency contacts to come through even when your iPhone or notifications are silenced. Open Contacts . Select a contact, then tap Edit. Tap Ringtone or Text Tone, then turn on Emergency Bypass.


1 Answers

I'm not sure on how to obtain the different numbers, but assuming you have a set of these (let's say a dictionary by country), then you can use the network information on deciding which country the phone is currently located in.

You can do that by using the CoreTelephony framework, specifically the CTTelephonyNetworkInfo and CTCarrier classes. Here's a small sample that will obtain the ISO 3166-1 country code of the current carrier.

CTTelephonyNetworkInfo *network = [[[CTTelephonyNetworkInfo alloc] init] autorelease];
CTCarrier *carrier = [network subscriberCellularProvider];
NSString *countryCode = [carrier isoCountryCode];

Now countryCode will have the code (to my knowledge the Alpha-2 code), that is unique for each country, here's a list of these

like image 84
Henri Normak Avatar answered Oct 08 '22 22:10

Henri Normak