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?
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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With