Java Reference
In-Depth Information
public void startApp() {
// List of active connections.
String[] connections = PushRegistry.listConnections(true);
for (int i=0; i < connections.length; i++)
{
if(connections[i].equals("sms://:1234")) {
new Thread() {
public void run() {
Receiver.openReceiver();
}
} .start();
}
} ...
}
One other use of the push registry should be mentioned before we
leave this topic. The PushRegistry class provides a method which
allows a running MIDlet to register itself or another MIDlet in the same
suite for activation at a given time:
public static long registerAlarm(String midlet, long time)
The midlet argument is the class name of the MIDlet to be launched
at the time specified by the time argument. The launch time is specified
in milliseconds since January 1, 1970, 00:00:00 GMT. The push registry
may contain only one outstanding activation time entry per MIDlet in
each installed MIDlet suite. If a previous activation entry is registered, it
is replaced by the current invocation and the previous value is returned.
If no previous wakeup time has been set, zero is returned.
The PushRegistry is a protected API; a signed MIDlet suite which
registers connections statically or contains MIDlets which register con-
nections or alarms must explicitly request permission:
MIDlet-Permissions: javax.microedition.io.PushRegistry, ...
Note that a signed MIDlet suite must also explicitly request the per-
missions necessary to open the connection types of any connections it
wishes to register. If the protection domain to which the signed MIDlet
suite would be bound grants, or potentially grants, the requested permis-
sion, the MIDlet suite can be installed and the MIDlets it contains can
register and deregister connections and alarms, either automatically or
with user permission, depending on the security policy in effect.
Untrusted MIDlets do not require a MIDlet-Permissions entry.
Whether access is granted to the Push Registry API depends on the
security policy for the untrusted protection domain in effect on the
device.
 
Search WWH ::




Custom Search