The push registry enables MIDlets to set themselves up to be launched automatically, by setting an alarm or by sending . The push registry manages network- and timer-initiated MIDlet activation; that is, it enables an inbound network connection or a timer-based alarm to wake a MIDlet up. For example, you can write a workgroup application that employs network activation to wake up and process newly received email, or new appointments that have been scheduled. Or you can use timer-based activation to schedule your MIDlet to synchronize with a server every so often then go to sleep.
This is a general property of MIDP2.0 specification.But different vendors have implemented it differently. For eg; in Nokia & Sonyericsson phones there a permission message is displayed whether you want to activate the push registered application. Where as in Siemens phones only a star sign will be displayed.
Contents |
a server IP address, a comma-delimited list of IP addresses, or an * to allow any connection).
MIDlet suite.
disable an existing alarm for the MIDlet if the argument supplied is zero.
The following exceptions should be caught:
It is useful to note that a MIDlet can initiate a socket or HTTP connection after it has been awakened by an incoming message, if further exchange of data is required.
The port specified can be from the full range 1 to 65535, however the following ports are reserved and must not be used:
Push Registry can handle requests to register connections in two ways:
Dynamic registration is a MIDlet notifying the AMS at run time that it wants to be activated by an incoming network connection or alarm event should the MIDlet be exited prior to that event occurring.
For a connection the registerConnection method is used:
registerConnection(String connection, String midlet, String filter)
and
this.getClass().getName()
can be used to specify the current MIDlet.
Some of the examples for Dynamic Registration :
registerConnection(“sms://:” + portNumber); registerConnection(“datagram://:” + portNumber);
If a connections sender and connection type are known when the MIDlet is installed, the registration request can be made at installation, and is therefore regarded as static. Static requests are defined in the JAD file using the Midlet-Push-<n> attribute:
MIDlet-Push-<n>: <ConnectionURL>, <MIDletClassName>, <AllowedSender>
where n is a sequence number allowing more than one connection to be declared, ConnectionURL is the URL to monitor for an incoming connection, MIDletClassName is the MIDlet to start, and AllowedSender is the filter: a list of IP addresses or * for any.
An example for SMS connection :
MIDlet-Push-1: sms://:10000, TestMIDlet, *
Dynamic registrations can be removed by using unregisterConnection specifying the connection only:
unregisterConnection(“sms://:10000”)
In startApp():
String connectsFound[]; connectsFound = PushRegistry.listConnections(true);
This returns the list of registered connections.
if connectsFound == null || connectsFound.length == 0) { ~ started by user, code to exit or bypass push-related activity ~ } else ~ started by inbound connection so code for push registry initiation ~ }
Sun Resourece:
http://developers.sun.com/techtopics/mobility/midp/articles/pushreg/
java world resoure: http://www.javaworld.com/javaworld/jw-04-2006/jw-0417-push.html
Sonyericsson resource: http://developer.sonyericsson.com/site/global/techsupport/tipstrickscode/java/p_tips_java_1201.jsp