Java Reference
In-Depth Information
The first entry indicates any IP address, the second entry allows the
last three digits of the IP address to take any value, while the last entry
allows only the last digit to have any value. So the full entry for the
MIDlet-Push- < n >
attribute in a JAD file may look something like this:
MIDlet-Push-1: sms://:1234, com.symbian.devnet.ChatMIDlet, *
MIDlet-Push-2: socket://:3000, com.symbian.devnet.ChatMIDlet, 129.70.40.*
If the request for a static connection registration cannot be fulfilled
then the AMS must not install the MIDlet. Examples of when a registration
request might fail include the requested protocol not being supported
by the device, or the requested port number being already allocated to
another application.
To register a dynamic connection with the AMS we use the static
registerConnection() method of PushRegistry :
"com.symbian.devnet.ChatMIDlet", "*");
The arguments take precisely the same format as those used to make up
the MIDlet-Push- < n >
entry in a JAD or manifest. Upon registration,
the dynamic connection behaves in an identical manner to a static
connection registered via the application descriptor. To un-register a
dynamic connection, the static Boolean unregisterConnection()
method of PushRegistry is used:
boolean result = PushRegistry.unregisterConnection(("sms://:1234");
If the dynamic connection is successfully unregistered, a value of
true is returned. The AMS responds to input activity on a registered
connection by launching the corresponding MIDlet (assuming that the
MIDlet is not already running). The MIDlet responds to the incoming
connection by launching a thread to handle the incoming data in the
startApp() method. Using a separate thread is recommended practice
for avoiding conflicts between blocking I/O operations and normal user
interaction events. For a MIDlet registered for incoming SMS messages,
the startApp() method might look something like this:
Search WWH ::

Custom Search