Progress will discontinue Telerik Platform on May 10th, 2018. Learn more

Handling Push Notifications in a Native iOS App

Handling Push Notifications in a Native iOS App

Push notifications are handled differently on iOS depending on whether your app is in the foreground or in the background.

When a push notification for the application is received while it is in the background, the iOS notification center handles the push notification automatically.

In the foreground, it is up to you to handle it in the didReceiveRemoteNotification app delegate event. Ideally, you will write your own implementation, but if you want to, you can use the [Everlive handlePush:userInfo] Backend Services iOS SDK method to display the notification in a simple UIAlert dialog. This is shown in the next example:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo 
{
    [Everlive handlePush:userInfo];
}
 func application(application: UIApplication, didReceiveRemoteNotification userInfo: NSDictionary) {
        var notification:NSDictionary = userInfo.objectForKey("aps") as NSDictionary
        // let Everlive handle push notifications without category
        if notification.objectForKey("category") == nil {
            Everlive.handlePush(userInfo)
        }
    }

See Also


Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.