Enable Apple Push Notification

DZone 's Guide to

Enable Apple Push Notification

This article explains how iOS remote notification works, and shows you how to enable push notification.

· Mobile Zone ·
Free Resource

In continuation with the previous article, this article explains how iOS remote notification works. Below graphics explain how basics of notification in iOS. We will go through each step one by one.

Step 1: Register your device with APNS server

First thing we need to request apple to register your device with apns. For this you need to call below code from your launcher controller.


    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)


        [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];

        [[UIApplication sharedApplication] registerForRemoteNotifications];



        [[UIApplication sharedApplication] registerForRemoteNotificationTypes:

        (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];



Once you call this method from your controller, you will get a callback to your Appdelegate method:  didRegisterForRemoteNotificationsWithDeviceToken. You will get device token from apple server in hex format. For a sample code check out our open source iOS SDK:

Applozic-iOS-SDK – iOS Chat & Messaging SDKgithub.com

Step 2: Send device token to application server

Once you receive device token after apple registration, you need to send this token to your application server for further use. This device token is the unique identifier for apple to identify your device while sending push notification.

Step 3: Server will send notification update to device

For your application server to communicate to apns server, first you need to authenticate yourself to apns. For authentication, you need to sign your push request with APNS SSL certificate. Here is the step to step guide how to get APNS SSL certificate.

Once you have apns device token and SSL certificate available on application server, you are good to send push notification to device.

ios ,mobile ,chat ,sdk for devices

Published at DZone with permission of Adarsh Kumar . See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}