Search code examples
iphoneobjective-cappointment

How can I make a call, as I recieve a push notification?


I have developed an appointment application. When I receive a push notification, I want to make a call to a particular person, but right now it is just opening the application when I get a push notification.

How do I write a code to make a call to a particular appointment as I get the push notification of that appointment?


Solution

  • Upon notification, open the dialer app with the given phone number. Note: this will initially launch your app, then quickly switch to the dialer.

    - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://5555555555"]];
    }