Just An Application

July 23, 2009

What’s New In MIDP 3.0 ? Part 37: ScreenSaver MIDlets

Filed under: Java, JME, MIDlets, MIDP, MIDP3 — Tags: , , , , — Simon Lewis @ 8:03 pm

The ScreenSaver MIDlet Model

  • A ScreenSaver MIDlet is any MIDlet which has been declared with a type of screensaver at installation time.

  • A ScreenSaver MIDlet may be selected by the user as the current screen saver.

  • A ScreenSaver MIDlet is responsible for determining when it should be acting as the screen saver.

    • To do this it must determine

      1. whether it is the currently selected screen saver

      2. when the device enters and leaves screensaver mode

  • A MIDlet can determine whether it is the currently selected screen saver by calling it’s isSelectedScreenSaver() method.

  • A MIDlet can determine when the device enters and leaves screensaver mode by listening for EventData.SCREENSAVER_MODE events.

  • A ScreenSaver MIDlet will be started automatically if it is is the currently selected screen saver and it is not running when the device enters screen saver mode.


  1. It is not clear what behaviour is expected of a ScreenSaver MIDlet if it has access to multiple Displays.

  2. Although there is apparently a potential race-condition if a ScreenSaver MIDlet is started automatically when the device enters screen saver mode, the semantics of the EventManager.addEventListener() methods should help avoid this. As the EventManager class documentation says

    For system events, as soon as a listener is added or an application is registered to be launched the current value is checked. If the current value is matched, the listener MUST be immediately notified or the application is launched.

    If the ScreenSaver MIDlet uses the EventManager.addEventListener(String, EventDataListener, boolean) variant of the method to register for the EventData.SCREENSAVER_MODE eventthen it will be notified of current state of the device’s screen saver mode

  3. Listening for the EventData.SCREENSAVER_MODE requires an EventPermission for that event with an action of read. A MIDlet Suite containing a Screensaver MIDlet needs to ensure it requests that permission.

  4. In the javax.microedition.midlet package documentation, when describing the sequence of events that the screen saver MIDlet MAY expect it says

    The MIDlet’s Display capabilities are changed to indicate no further user input events will be delivered to the screen saver MIDlet.

    It is not clear whether capabilities in this context means the values returned by the Display.getCapabilities() method. The reference to Display and the use of the word indicate seem to imply that it does, but if so then it contradicts the Display documentation where it says

    A given Display’s capabilities are static; that is, they do not change over time or in response to the state of the device.

    If not then this should be made clear.

Copyright (c) 2009 By Simon Lewis. All Rights Reserved


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at WordPress.com.

%d bloggers like this: