Class NotificationListener

  extended by net.rim.pushsdk.acknowledgement.NotificationListener
Direct Known Subclasses:
AnyNotificationListener, FailureNotificationListener, LastNotificationListener, SuccessNotificationListener

public abstract class NotificationListener
extends Object

Abstract class that defines common functionality for the notification message listeners.

Every custom notification listener that is meant to be registered with the SDK (in NotificationListenerService) must extend this class and set the listener type to one of the ListenerType enumerated values. See an example in SuccessNotificationListener. Listeners can be registered through pushsdk-acknowledgement-context.xml as shown in the example below:

 <bean id="successListener" 
 <bean id="registerListeners" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
     <property name="targetObject"><ref local="notificationListenerService"/></property>
     <property name="targetMethod"><value>addListeners</value></property>
     <property name="arguments">
             <entry key="${appid}">
                     <ref bean="anyListener"/>
                     <ref bean="successListener"/>
                     <ref bean="failureListener"/>
                     <ref bean="lastListener"/>
The map entry key is the push application id that the listener is registering to.
Another way to register a listener is programmatically through the NotificationListenerService addListeners method. The preferred way is through the pushsdk-acknowledgement-context configuration XML.


Field Summary
protected  ListenerType listenerType
Constructor Summary
Method Summary
abstract  void processNotification(String pushId, PushOutcome outcome)
          Processes the result notification.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


protected ListenerType listenerType
Constructor Detail


public NotificationListener()
Method Detail


public abstract void processNotification(String pushId,
                                         PushOutcome outcome)
                                  throws PushSDKException
Processes the result notification.

The client address (e.g. PIN) in the result notification from the PPG was mapped to the address in the provided PushOutcome using the currently known mapping. This may result in incorrect results if a subscriber or device swap occurred after the push request was issued.

Note: The PushOutcome.getAddress() may return a value of '*' (without the quotes) that indicates the code applies to all addresses of the push with the specified push id.

pushId - push id to which the notification pertains
outcome - the outcome of pushing to a particular address
PushSDKException - error from processing the result notification. The exception stack trace will have details of the error

Copyright © 2011 Research In Motion. All Rights Reserved.