17.1. Alarm-Based MIDlet Launch

It can often be useful for a MIDlet to be launched at a preset time to provide information to the user in a timely fashion. For example, a MIDlet that sells movie tickets might set an alarm to warn the ticket-holding user about the impending start time of the movie.

To use alarm-based notification, a MIDlet calls the PushRegistry.registerAlarm method. The MIDlet must supply the name of the MIDlet to launch (it must be a MIDlet in the same MIDlet suite) and a launch time. The named MIDlet must have been registered in the JAD file or the JAR manifest with a MIDlet-n attribute. Providing a launch time of zero removes any alarm.

The push registry supports one alarm per MIDlet. If a registration occurs for a MIDlet ...

Get Programming Wireless Devices with the Java™ 2 Platform, Micro Edition, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.