Apple Push Notification API

The Apple Push Notification API allows applications to provide various types of push notifications to devices, such as sounds (audible alerts), alerts (displaying an alert on the screen), and badges (displaying an image or number on the application icon). Push notifications require network connectivity.

The client library libclientrt wraps the Apple Push Notification API in the file SUPPushNotification.h.

In addition to using the Apple Push Notification APIs in a client application, you must configure the push configuration on the server. This is performed under Server Configuration > Messaging > Apple Push Configuration in Sybase Control Center. You must configure the device application name (for push), the device certificate (for push), the Apple gateway, and the gateway port.

The following API methods abstract the Unwired Server, resolve the push-related settings, and register with an Apple Push server, if required. You can call these methods in the "applicationDidFinishLaunching" function of the client application:

@interface SUPPushNotification : NSObject 
{

}
+(void)setupForPush:(UIApplication*)application;
+(void)deviceTokenForPush:(UIApplication*)application deviceToken:(NSData
*)devToken;
+(void)pushRegistrationFailed:(UIApplication*)application
errorInfo:(NSError *)err;
+(void)pushNotification:(UIApplication*)application
notifyData:(NSDictionary *)userInfo;

+(void)setupForPush:(UIApplication*)application

After a device successfully registers for push notifications through Apple Push Notification Service, iOS calls the didRegisterForRemoteNotificationWithDeviceToken method in the client application. iOS passes the registered device token to this function, and the functions calls the deviceTokenForPush API to pass the device token to Unwired Server:

+(void)deviceTokenForPush:(UIApplication*)application deviceToken:(NSData
*)devToken

If for any reason the registration with Apple Push Notification Service fails, iOS calls didFailToRegisterForRemoteNotificationsWithError in the client application which calls the following API:

+(void)pushRegistrationFailed:(UIApplication*)application errorInfo: (NSError *)err

When iOS receives a notification from Apple Push Notification Service for an application, it calls didReceiveRemoteNotification in the client application. This calls the pushNotification API:

+(void)pushNotification:(UIApplication*)application
notifyData:(NSDictionary *)userInfo