Registering Listeners for Push Notifications

(Optional) The application should register and implement a listener interface to receive native or payload push notifications.

The IODPPushNotificationListener interface should be implemented by the application to receive the BES native push notifications on BlackBerry devices. The onPushNotification method is called when a new BES push notification is received. For more information on configuring BES native notifications on Sybase Control Center, see BES Native Notification Properties in Sybase Control Center for Sybase Unwired Platform.

Note: When the application is not running or terminated, the BES notifications will not reach the client device. The IODPPushNotificationListener will not be invoked.

The following code illustrates how to register listeners for native push notifications.

Public class Mylistener implements IODPPushNotifciationListner 
{
    Public int onPushNotifcation(Hashtable ht)
    {
          If(getpayload == true)
             Return 0;
          Else
             Return 1;
    }
}
The return values for onPushNotification include:
  • 0 – The client receives the payload notification from the server, if the online/payload push with native notification option is selected in the Push Configurations tab. For more information, see Configuring Native Notifications in Sybase Control Center for Sybase Unwired Platform.
  • 1 – The client does not receive the payload notification from the server.