net.rim.pushsdk.acknowledgement
Class NotificationListener
java.lang.Object
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"
class="net.rim.pushsdk.acknowledgement.SuccessNotificationListener">
</bean>
<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">
<map>
<entry key="${appid}">
<list>
<ref bean="anyListener"/>
<ref bean="successListener"/>
<ref bean="failureListener"/>
<ref bean="lastListener"/>
</list>
</entry>
</map>
</property>
</bean>
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.
- Author:
- dstrelbytsky
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
listenerType
protected ListenerType listenerType
NotificationListener
public NotificationListener()
processNotification
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.
- Parameters:
pushId - push id to which the notification pertainsoutcome - the outcome of pushing to a particular address
- Throws:
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.