net.rim.blackberry.api.push
Class PushApplicationRegistry

java.lang.Object
  extended by net.rim.blackberry.api.push.PushApplicationRegistry

public class PushApplicationRegistry
extends Object

Provides mechanism to register push applications.

Since:
BlackBerry API 5.0.0

Method Summary
static PushApplicationStatus getStatus(PushApplicationDescriptor pad)
          Returns current registration status.
static void registerApplication(PushApplicationDescriptor pad)
          Registers given client-side push application for incoming push messages.
static void unregisterApplication()
          Unregisters a client-side push application.
static void unregisterApplication(PushApplicationDescriptor pad)
          Unregisters a client-side push application from the specified port.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Method Detail

registerApplication

public static void registerApplication(PushApplicationDescriptor pad)
                                throws IllegalArgumentException
Registers given client-side push application for incoming push messages. The registration call is asynchronous and may involve server communication. The application will be notified with registration call outcome through PushApplication#onStatusChange() callback method.

The PushApplicationDescriptor argument contains optional parameter ApplicationDescriptor which defines application startup arguments passed into the static void main(String[] args) method. MIDlet application can not specify main method arguments through ApplicationDescriptor because it is started differently.

If the ApplicationDescriptor is specified the corresponding client-side push application will be started to verify that it implements the PushApplication interface. It will remain running in the background until the registration is finished which means that PushApplication.onStatusChange(PushApplicationStatus) method will be called. The application should exit to save system resources if push messages are expected to be rare.

Application specified by descriptor should belong to the same application group with the current application, otherwise, IllegalArgumentException would be thrown.

Parameters:
pad - pad defines client-side push application descriptor properties
Throws:
IllegalArgumentException
Since:
BlackBerry API 5.0.0

unregisterApplication

public static void unregisterApplication()
Unregisters a client-side push application. The caller to this method should belong to the same code module group that called PushApplicationRegistry.registerApplication(PushApplicationDescriptor) method.

If the application is listening on multiple ports then it will be unregistered from all the ports. Refer to PushApplicationRegistry.unregisterApplication(int) method to unregister from a specific port. If application is not registered with push registry then no exception is thrown.

Since:
BlackBerry API 5.0.0

unregisterApplication

public static void unregisterApplication(PushApplicationDescriptor pad)
                                  throws IllegalArgumentException
Unregisters a client-side push application from the specified port. The caller to this method should belong to the same code module group that called the PushApplicationRegistry.registerApplication(PushApplicationDescriptor) method

Throws:
IllegalArgumentException - if application is not listening on the specified port
Since:
BlackBerry API 5.0.0

getStatus

public static PushApplicationStatus getStatus(PushApplicationDescriptor pad)
Returns current registration status. Refer to PushApplicationStatus for status constants.

The method returns client side status only while server may have a different value.

Parameters:
pad - optional push application descriptor specifying application properties
Returns:
current registration status for application
Since:
BlackBerry API 5.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal