Enabling Apple Push Notifications

You use the Apple Push Notification service to propagate information from the backend to the device. Using the native iOS push services , you can enable APNS for iOS applications.

The following code illustrates how to enable APNS on a device.
//Enable APNS
To enable APNS, you need to implement the following in the application delegate of the application that has to receive notifications.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
	[ODPClientConnection setupForPush:application];
}
* Callback by the system where the token is provided to the client application so that this
 can be passed on to the provider. In this case, “deviceTokenForPush” and “setupForPush” 
are APIs provided by SUP to enable APNS and pass the token to SUP Server

- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { 
	[ODPClientConnection deviceTokenForPush:app deviceToken:deviceToken];
}
* Callback by the system if registering for remote notification failed. 
- (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err {
	[ODPClientConnection pushRegistrationFailed:app errorInfo:err];
       }
// You can alternately implement the pushRegistrationFailed API:
// +(void)pushRegistrationFailed:(UIApplication*)application errorInfo: (NSError *)err
* Callback when notification is sent. 
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
	[ODPClientConnection pushNotification:application notifyData:userInfo];
}