public class EventManager
extends java.lang.Object
The EventManager
class provides methods to post and listen for
events, to determine the events supported by the device, and to register
applications to be automatically launched in response to events. The system
publishes some events and applications publish other events.
posted
it is given a timestamp and
the identity of the application, if any, that posted it.
See the Event
class for the definition of events.
The Event
class defines a set of commonly available
system events. Individual devices may also support unique system
events in addition to those defined in Event
. Event
names are limited to the characters allowed by the Java Language
Specification [JLS] for identifiers.
Event names are case sensitive; for example, "COM.ORACLE" and
"com.oracle" are different names. In order to avoid name collisions names
defined by applications and specific implementations SHOULD use the common
reverse domain notation and SHOULD contain at least one ".".
For example com.YourCompanyName.SomeCustomEvent.
When registering and unregistering listeners and for application launch, events may be requested using a prefix and an optional single final asterisk "*". The prefix must be at least 1 character long. For example, the pattern "com.mot.*" will match any and all event names that begin with "com.mot.".
Some events may convey privileged information to the application and
therefore the application must have the appropriate permission to access such
events. Additionally, the ability to post events or to register applications
to launch automatically on events must be restricted to applications with the
appropriate permissions. See the EventPermission
class for more
details.
All events posted MUST be delivered to all valid recipients in each
runtime environment on the device that implements this specification.
The recipients register themselves to receive the events with
addEventListener
methods. The event API is asynchronous, events are delivered via a listener and
event posts MUST NOT block the application execution.
Each event MUST be delivered to each listener exactly once.
Each event MUST successfully launch the application only once.
An event matches a recipient if all of the following are true:
Events are discarded after they have been delivered to all the valid recipients.
If no valid recipients can be identified the event is discarded immediately
except in the case that an event caused the launch of an application the event MUST
be retained until the application returns from the
MIDlet.startApp
method.
This insures that the application is given a chance to listen for the event
before the event is discarded. Once the listener has been registered the
event is retained until it can be delivered to the listener.
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. Performing the match in addEventListener
and registerApplication
removes a race condition that could
exist between those actions and the application needing to poll the
current value and check the condition.
Applications may be launched automatically in response to events. The registration
is done with registerApplication
methods. The application will not be launched if it is already running. The application
will be launched when the event value matches the requested value. Otherwise
the application will not be launched. An application can register to launch
on a particular event either via static jar attribute or dynamically
through methods in the EventManager
class.
Static registration to application launch on events is done by
adding the MIDlet-Event-Launch-<n>
attribute to
the JAR Manifest. The attribute consists of the class
name of the application to be launched followed an optional
launch condition that MUST cause the application to be
launched. For boolean
and String
type
events the launch condition may consist of just the event name in which case
the application will be launched on any change to the event.
Static registration of launch on event occurs during installation of the
application suite or during a re-installation (update), if installation and/or
update of application suites is supported by the implementation. Otherwise,
registration exist for pre-installed applications and cannot be changed.
If the application suite is being updated (re-installed), then any pre-existing
registrations, both static and dynamic, for launching the application suite
MUST be removed. Multiple MIDlet-Event-Launch
attributes can used
to register launch on several event requests.
If the implementation does not have the resources to register all of the
requested launch requests the installation MUST fail with
Status Code 901
(Insufficient Memory).
If the application does not have EventPermission
with the
name equal to the event name and action equal to "register", the
installation MUST fail with
Status Code 910 (Application authorization failure).
If an attempt is made to register an application for a system event that is not supported by the device, or if for any event an invalid value is requested, or if for any event an inappropriate launch condition format is specified, then the installation MUST proceed without registering the application for the event.
The Jar Manifest attribute is defined as follows:
MIDlet-Event-Launch-<n>:<Classname>;<Launch-Condition>
Where:
MIDlet-Event-Launch-<n>
= The application launch registration
attribute name. The value of <n> starts at 1 and MUST use consecutive
ordinal numbers for additional application launch registrations. The first
missing entry terminates the list. Any additional entries are ignored.
Classname
= The fully-qualified name of the class to launch;
must refer to a valid application for the current profile.
For MEEP 8, the class must implement
MIDlet
found in the current applications suite.
Launch-Condition
= The condition that should cause the
application to be launched. Each MIDlet-Event-Launch-<n>
attribute
may include zero or one launch conditions. If one or more of the launch
events is matched, then the application MUST be launched. Each launch
condition MUST be of one of the following forms :
Event Type |
Launch-Condition Format |
|
|
|
|
|
|
|
|
Event-Name
= The name of the event on which to launch the
application.
String-Event-Value
= The optional event value of interest. The
application will be launched if the event value is equal to this value.
The event value is quoted and can not contain a quote.
Long-Event-Value
= The application will be launched if the
event value falls within the range between the low and high values (inclusive).
The value must contain only characters valid for Long Literals
as defined by the Java Language Specification
[JLS] and are accepted by the
java.lang.Long.valueOf
method.
Double-Event-Value
= The application will be launched if the
event value falls within the range between the low and high values (inclusive).
The value must contain only characters valid for Floating Point Literals
as defined by the Java Language Specification
[JLS] and are accepted by the
java.lang.Double.valueOf
method.
Note: Care should be taken when registering applications to launch on events that change often as frequent attempts to launch the application may negatively impact performance. The implementation may limit the launch frequency to avoid degrading device performance or battery lifetime.
MIDlet-Name: SystemUtilities MIDlet-Version: 1.0.1 MIDlet-Vendor: FictionalCo MIDlet-1: UsageMonitor, , com.fictionalco.UsageMonitor MIDlet-2: PowerManager, , com.fictionalco.PowerMgr MIDlet-Event-Launch-1: com.fictionalco.UsageMonitor;SYSTEM_STATE="STARTUP" MIDlet-Event-Launch-2: com.fictionalco.PowerMgr;BATTERY_LEVEL=5,100 MicroEdition-Profile: MEEP-8.0 MicroEdition-Configuration: CLDC-1.8 MIDlet-Description: Useful system utilities MIDlet-Jar-URL: http://www.fictionalco.com/SysUtils.jar |
In addition to statically registering an application to launch in response to
events through appropriate entries in the Jar Manifest, an application can
dynamically register applications using the
registerApplication
methods.
The implementation MUST support at least five (5) launch registrations
whether registered via MIDlet-Event-Launch-<n>
attributes
or the API.
The application must first get an instance of EventManager
.
The EventManager.getCurrent
method is then called to get an
Event object for the desired system event. The application must have the
required permission to query the requested system event or a
SecurityException
will be thrown. The appropriate
getXXX
method may then be called to get the current event value.
EventManager ssm = EventManager.getInstance(); try { battery = ssm.getCurrent(BATTERY_LEVEL); } catch (SecurityException e) { ... } batteryLevel = battery.getInt(); |
The application must first get an instance of EventManager
.
The EventManager.addListener
method is called to add the
listener using system event or the application event name. The application
must have the required permission to query the requested event or a
SecurityException
will be thrown.
Event battery; EventManager ssm = EventManager.getInstance(); // Receive events at 10% and 20% battery level ssm.addEventListener(BATTERY_LEVEL, this, 10, 20); // Also receive events at 90% and 100% battery level ssm.addEventListener(BATTERY_LEVEL, this, 90, 100); |
The application had previously registered this object as a listener for
multiple events and has implemented the
EventListener.handleEvent
method as follows.
handleEvent(Event event) { String eventName = event.getName(); int batteryLevel; boolean bodyOpen; if (eventName.equals(BATTERY_LEVEL)) { batteryLevel = event.getInt(); } else if (eventName.equals(BODY_OPEN)) { bodyOpen = event.getBoolean(); } } |
The application must first get an instance of EventManager
.
An Event
object must then be created using the appropriate
constructor. The EventManager.post
method is called to send
the event.The application must have the appropriate permission to post
the event or a SecurityException
will be thrown.
The application must first get an instance of EventManager
.
The appropriate registerApplication
method is then called to
register to be launched on the event.
Event battery; EventManager ssm = EventManager.getInstance(); try { // Launch the application if the battery level drops below 10% ssm.registerApplication(BATTERY_LEVEL, "com.fictionalco.PowerMgr", 0, 10); } catch (SecurityException e) { ... } |
Modifier | Constructor and Description |
---|---|
protected |
EventManager()
Creates a new instance of EventManager.
|
Modifier and Type | Method and Description |
---|---|
void |
addEventListener(java.lang.String event,
EventListener listener)
Add an
EventListener to be notified. |
void |
addEventListener(java.lang.String event,
EventListener listener,
boolean value)
Add an event listener to be notified of events with
boolean
values. |
void |
addEventListener(java.lang.String event,
EventListener listener,
double low,
double high)
Add an event listener to be notified of an event represented by
double values. |
void |
addEventListener(java.lang.String event,
EventListener listener,
long low,
long high)
Add an event listener to be notified of an event represented by
int or long values. |
void |
addEventListener(java.lang.String event,
EventListener listener,
java.lang.String[] values)
Add an event listener to be notified of an event represented by
String values. |
Event |
getCurrent(java.lang.String event)
Returns an
Event object for the requested system event. |
static EventManager |
getInstance()
Returns the instance of
EventManager . |
java.lang.String[] |
getSystemEventNames()
Returns a
String array containing the names of all the
system events available on the device. |
void |
post(Event event)
Post an event.
|
void |
registerApplication(java.lang.String event,
java.lang.String application)
Register an application to be launched on an event.
|
void |
registerApplication(java.lang.String event,
java.lang.String application,
boolean value)
Register an application to be launched in response to an event
represented by a
boolean values. |
void |
registerApplication(java.lang.String event,
java.lang.String application,
double low,
double high)
Register an application to be launched in response to an event
represented by a
double value. |
void |
registerApplication(java.lang.String event,
java.lang.String application,
long low,
long high)
Register an application to be launched in response to an event
represented by an
int or long value. |
void |
registerApplication(java.lang.String event,
java.lang.String application,
java.lang.String[] values)
Register an application to be launched in response to a event represented
by a
String value. |
void |
removeEventListener(java.lang.String event,
EventListener listener)
Removes an event listener for the named event(s) including wildcards.
|
void |
unregisterApplication(java.lang.String event,
java.lang.String application)
Unregister an application from launching in response to an event.
|
protected EventManager()
public static EventManager getInstance()
EventManager
.EventManager
.public java.lang.String[] getSystemEventNames()
String
array containing the names of all the
system events available on the device. Application specific event names
are not listed.String
array containing the names of all the
system events available.Event
,
getCurrent(String)
public Event getCurrent(java.lang.String event)
Event
object for the requested system event.
If the argument is PowerStateEvent.BATTERY_LEVEL
, a
call to this method SHOULD return the same value as a call to
PowerManager.getBatteryLevel()
.
If the argument is PowerStateEvent.POWER_STATE
, a
call to this method SHOULD return the same value as a call to
PowerManager.getPowerState()
.
event
- The name for the event.Event
object for the requested system event; or
null
if the requested name is not a known
system event as returned from getSystemEventNames()
.java.lang.SecurityException
- If the application does not have EventPermission
with the name equal the event name and action equals "read".java.lang.NullPointerException
- If event
is null
.Event
,
EventPermission
,
getSystemEventNames()
public void post(Event event) throws java.io.IOException
Post an event. The event is posted and the method MUST NOT wait for the event to be delivered. The event MUST be delivered to any recipient that matches the event.
If the name of the event is recognized by the system the value
provided MUST match the value type for the event.
The time from
java.lang.System.currentTimeMillis
initializes the value
of the Event.getTimestamp
method.
The implementation sets the event source to be the calling application.
event
- The event to post. The contents of the Event
object are the value for the event.java.lang.NullPointerException
- If event
is null
.java.lang.IllegalArgumentException
- If event
names an event for which the type
is known to the system and the value provided
does not match.java.lang.SecurityException
- If the application does not have the EventPermission
with the name equal the event name and
action equals "post"; or if the event name is one of those
returned by getSystemEventNames()
and the
application does not have the EventPermission
with the name equal the event name and
action equals "postsystem".java.io.IOException
- If there are insufficient resources to retain the Event
until it can be delivered to all listeners.
Refer to Event
for the minimum
size the MUST be supported.Event
,
EventPermission
public void addEventListener(java.lang.String event, EventListener listener)
Add an EventListener
to be notified.
The listener will be notified for changes in every known event that
matches the requested name.
If the listener is removed using
removeEventListener
then it will no longer
be notified.
event
- The event(s) for which the listener will be added; if
event
contains a final "*", the listener will
match any event name with identical prefix (without the "*").listener
- The listener to add.java.lang.NullPointerException
- If listener
or event
is
null
java.lang.SecurityException
- If the application does not have EventPermission
with the name equal the event name and action equals "read".Event
,
removeEventListener(String, EventListener)
public void addEventListener(java.lang.String event, EventListener listener, boolean value)
Add an event listener to be notified of events with boolean
values. The listener will be called when the value changes to the
requested value. The listener will be called immediately for every known
event that matches the requested name and value.
If the listener is removed using
removeEventListener
then it will no longer
be notified.
event
- The event(s) for which the listener will be added; if
event
contains a final "*", the listener will
match any event name with identical prefix (without the "*").listener
- The listener to add.value
- The event value for which the listener should be notified.java.lang.NullPointerException
- If listener
or event
is
null
java.lang.IllegalArgumentException
- If the named event is a system event and is known not to be a
boolean
event.java.lang.SecurityException
- If the application does not have EventPermission
with
the name equal the event name and action equals "read".Event
,
addEventListener(String, EventListener, boolean)
public void addEventListener(java.lang.String event, EventListener listener, java.lang.String[] values)
Add an event listener to be notified of an event represented by
String
values. The listener will be notified if the event
contains one of the requested values.
The listener will be called immediately for every known value that
matches the requested name and value.
If the listener is removed using
removeEventListener
then it will be removed
for all values and will no longer be notified.
event
- The event(s) for which the listener will be added; if
event
contains a final "*", the listener will
match any event name with identical prefix (without the "*").listener
- The listener to add.values
- The event values for which the listener should be notified.java.lang.NullPointerException
- If listener
or events
is
null
.java.lang.IllegalArgumentException
- If values
contain strings that are not valid
for the event or if the named event is a system event and
is known not to be a String
event.java.lang.SecurityException
- If the application does not have EventPermission
with
the name equal the event name and action equals "read".Event
,
removeEventListener(String, EventListener)
public void addEventListener(java.lang.String event, EventListener listener, double low, double high)
Add an event listener to be notified of an event represented by
double
values. The listener will be notified when the value
falls within the range between the low and high values (inclusive).
A listener may be added repeatedly using different ranges of values but will be
notified only once for any single change. The listener will be called immediately for
every known event that matches the requested name and value.
If the listener is removed using
removeEventListener
then it will be removed
for all ranges and will no longer be notified.
event
- The event(s) for which the listener will be added; if
event
contains a final "*", the listener will
match any event name with identical prefix (without the "*").listener
- The listener to add.low
- The low end of the range of interest.high
- The high end of the range of interest.java.lang.NullPointerException
- If listener
or event
is
null
.java.lang.IllegalArgumentException
- If high
is less than low
or if
either low
or high
is
NaN
or outside the valid range for the event or
if the named event is a system event and is known not to be a
double
event.java.lang.SecurityException
- If the application does not have EventPermission
with
the name equal the event name and action equals "read".Event
,
removeEventListener(String, EventListener)
public void addEventListener(java.lang.String event, EventListener listener, long low, long high)
Add an event listener to be notified of an event represented by
int
or long
values. The listener will be
notified when the value falls within the range between the low and
high values (inclusive). A listener may be added repeatedly using
different ranges of values but will be notified only once for any
single event change. The listener will be called immediately for every
known event that matches the requested name and value.
If the listener is removed using
removeEventListener
then it will be removed
for all ranges and will no longer be notified.
event
- The event(s) for which the listener will be added; if
event
contains a final "*", the listener will
match any event name with identical prefix (without the "*").listener
- The listener to add.low
- The low end of the range of interest.high
- The high end of the range of interest.java.lang.NullPointerException
- If listener
or event
is
null
.java.lang.IllegalArgumentException
- If high
is less than low
or if
either low
or high
is outside
the valid range of values for the event or if the named event
is a system event and is known not to be a long
event.java.lang.SecurityException
- If the application does not have EventPermission
with
the name equal the event name and action equals "read".Event
,
removeEventListener(String, EventListener)
public void removeEventListener(java.lang.String event, EventListener listener)
removeEventListener("*", listener)
.
The listener will no longer be notified of any matching event.
If the listener was added for multiple conditions then all of the
conditions will be removed for the event and listener.
If listener
had not previously been added as a
listener to the event then the request is ignored.event
- The event(s) for which the listener will be removed; if
event
contains a final "*", the listener will
match any event name with identical prefix (without the "*").listener
- The listener to remove.java.lang.NullPointerException
- If listener
or event
is
null
.Event
,
addEventListener(String, EventListener, boolean)
public void registerApplication(java.lang.String event, java.lang.String application) throws java.lang.ClassNotFoundException, java.io.IOException
Register an application to be launched on an event. An application can register multiple times with different events and values with each registration accumulating; duplicate registrations with the same input parameters will have no effect. The application MUST NOT be launched if it is already running.
If the application is unregistered using
unregisterApplication
then
it will no longer be launched in response to the event.
Note: Care should be taken when registering applications to launch on events that change often as frequent attempts to launch the application may negatively impact performance.
event
- The event(s) for which the application is to be registered; if
event
contains a final "*", the listener will
match any event name with identical prefix (without the "*").application
- The fully qualified class name of the application being
registered. The named application
class MUST
be registered in the JAD or JAR Manifest for the application
suite of the calling application
with a MIDlet-<n>
application attribute,
and MUST extend
javax.microedition.midlet.MIDlet
.java.lang.NullPointerException
- If event
or application
is null
.java.lang.IllegalArgumentException
- If application
does not refer to a valid
application for the current profile.
The named application
class
MUST be registered in the JAD or JAR Manifest for the
application suite of the calling application with a
MIDlet-<n>
application
attribute, and MUST extend
javax.microedition.midlet.MIDlet
.java.lang.SecurityException
- If the application does not have EventPermission
with
the name equal the event name and action equals "register".java.lang.ClassNotFoundException
- If the application class cannot be foundjava.io.IOException
- If there are insufficient resources to perform the registration.EventPermission
,
unregisterApplication(String, String)
public void registerApplication(java.lang.String event, java.lang.String application, boolean value) throws java.lang.ClassNotFoundException, java.io.IOException
Register an application to be launched in response to an event
represented by a boolean
values. The application will be
launched if the event matches the requested name and value.
An application can register multiple times with
different events and values with each registration accumulating;
duplicate registrations with the same input parameters will have
no effect. The application MUST be launched only once for any single
event change. The application MUST NOT be launched if it is already running.
If the application is unregistered using
unregisterApplication
then it will no
longer be launched in response to the event.
Note: Care should be taken when registering applications to launch on events that change often as frequent attempts to launch the application may negatively impact performance.
event
- The name of a boolean
event for which the application
is to be registered; if event
contains a final "*", the
listener will match any event name with identical prefix
(without the "*").application
- The fully qualified class name of the application being
registered. The named application
class MUST be
registered in the JAD or JAR Manifest for the application
suite of the calling application with a
MIDlet-<n>
application attribute, and
MUST extend
javax.microedition.midlet.MIDlet
.value
- The event value for which the application should be launched.java.lang.NullPointerException
- If event
or application
is null
.java.lang.IllegalArgumentException
- If application
does not refer to a valid
application for the current profile.
The named application
class
MUST be registered in the JAD or JAR Manifest for the application
suite of the calling application with a
MIDlet-<n>
application
attribute, and MUST extend
javax.microedition.midlet.MIDlet
.java.lang.IllegalArgumentException
- If the named event is a system event and is known not to be a
boolean
event.java.lang.SecurityException
- If the application does not have EventPermission
with
the name equal the event name and action equals "register".java.lang.ClassNotFoundException
- If the application class cannot be foundjava.io.IOException
- If there are insufficient resources to perform the registration.EventPermission
,
unregisterApplication(String, String)
public void registerApplication(java.lang.String event, java.lang.String application, double low, double high) throws java.lang.ClassNotFoundException, java.io.IOException
Register an application to be launched in response to an event
represented by a double
value. The application will be
launched if the event value falls within the range between the low
and high values (inclusive).
An application can register multiple times with different events
and values with each registration accumulating;
duplicate registrations with the same input parameters will have
no effect. The application MUST be launched only once for any single event change.
The application MUST NOT be launched if it is already running.
If the application is unregistered using
unregisterApplication
it will be
unregistered for all values and will no longer be launched in response to
the event.
Note: Care should be taken when registering applications to launch on events that change often as frequent attempts to launch the application may negatively impact performance.
event
- The name of the event to which the application is to be
registered; if event
contains a final "*", the
listener will match any event name with identical prefix
(without the "*").application
- The fully qualified class name of the application being
registered. The named application
class MUST
be registered in the JAD or JAR Manifest for the
application suite of the calling application
with a MIDlet-<n>
application attribute,
and MUST extend
javax.microedition.midlet.MIDlet
.low
- The low end of the range of interest.high
- The high end of the range of interest.java.lang.NullPointerException
- If event
or application
is null
.java.lang.IllegalArgumentException
- If application
does not refer to a valid
application for the current profile.
The named application
class
MUST be registered in the JAD or JAR Manifest for the application
suite of the calling application with a
MIDlet-<n>
application
attribute, and MUST extend
javax.microedition.midlet.MIDlet
.java.lang.IllegalArgumentException
- If the named event is a system event and is known not to be a
double
event.java.lang.IllegalArgumentException
- If high
is less than low
or if
either low
or high
is
NaN
or is outside the valid range of values
for the event.java.lang.IllegalArgumentException
- If application
does not refer to a valid
application for the current profile.
The named application
class
MUST be registered in the descriptor file or the JAR
Manifest with a MIDlet-<n>
record
and extends javax.microedition.midlet.MIDlet
.java.lang.SecurityException
- If the application does not have EventPermission
with
the name equal the event name and action equals "register".java.lang.ClassNotFoundException
- If the application class cannot be foundjava.io.IOException
- If there are insufficient resources to perform the registration.EventPermission
,
unregisterApplication(String, String)
public void registerApplication(java.lang.String event, java.lang.String application, long low, long high) throws java.lang.ClassNotFoundException, java.io.IOException
Register an application to be launched in response to an event
represented by an int
or long
value. The application will be
launched if the event value falls within the range between the low and
high values (inclusive).
An application can register multiple times with different events
and values with each registration accumulating;
duplicate registrations with the same input parameters will have
no effect. The application MUST be launched only once for any single event change.
The application MUST NOT be launched if it is already running.
If the application is unregistered using
unregisterApplication
it will be
unregistered for all values and will no longer be launched in response to
the event.
Note: Care should be taken when registering applications to launch on events that change often as frequent attempts to launch the application may negatively impact performance.
event
- The name of the event for which the application is to be
registered; if event
contains a final "*", the
listener will match any event name with identical prefix
(without the "*").application
- The fully qualified class name of the application being
registered. The named application
class MUST
be registered in the JAD or JAR Manifest for the application
suite of the calling application
with a MIDlet-<n>
application attribute,
and MUST extend
javax.microedition.midlet.MIDlet
.low
- The low end of the range of interest.high
- The high end of the range of interest.java.lang.NullPointerException
- If event
or application
is null
.java.lang.IllegalArgumentException
- If high
is less than low
or if
either low
or high
is outside
the valid range of values for the event.java.lang.IllegalArgumentException
- If application
does not refer to a valid
application for the current profile.
The named application
class
MUST be registered in the JAD or JAR Manifest for the application
suite of the calling application with a
MIDlet-<n>
application
attribute, and MUST extend
javax.microedition.midlet.MIDlet
.java.lang.SecurityException
- If the application does not have EventPermission
with
the name equal the event name and action equals "register".java.lang.ClassNotFoundException
- If the application class cannot be foundjava.io.IOException
- If there are insufficient resources to perform the registration.EventPermission
,
unregisterApplication(String, String)
public void registerApplication(java.lang.String event, java.lang.String application, java.lang.String[] values) throws java.lang.ClassNotFoundException, java.io.IOException
Register an application to be launched in response to a event represented
by a String
value. The application will be launched if the
event value changes to one of the values specified in the
values
parameter. An application can register multiple times
with different events and values with each registration accumulating;
duplicate registrations with the same input parameters will have
no effect.
The application MUST be launched only once for any single event change.
The application MUST NOT be launched if it is already running.
If the application is unregistered using
unregisterApplication
it will be
unregistered for all values and will no longer be launched in response to
the event.
Note: Care should be taken when registering applications to launch on events that change often as frequent attempts to launch the application may negatively impact performance.
event
- The name of the event for which the application is to be
registered; if event
contains a final "*", the
listener will match any event name with identical prefix
(without the "*").application
- The fully qualified class name of the application being
registered. The named application
class MUST
be registered
in the JAD or JAR Manifest for the application suite of
the calling application
with a MIDlet-<n>
application attribute,
and MUST extend
javax.microedition.midlet.MIDlet
.values
- The event values for which the application is to be
launched.java.lang.NullPointerException
- If event
, values
or
application
is null
or if
values
contains values that are null
.java.lang.IllegalArgumentException
- If the named event is a system event and is known not to be
an event with a String
value or if values
contains values that are not valid for the event.java.lang.IllegalArgumentException
- If application
does not refer to a valid
application for the current profile.
The named application
class
MUST be registered in the JAD or JAR Manifest for the application
suite of the calling application with a
MIDlet-<n>
application
attribute, and MUST extend
javax.microedition.midlet.MIDlet
.java.lang.SecurityException
- If the application does not have EventPermission
with
the name equal the event name and action equals "register".java.lang.ClassNotFoundException
- If the application class cannot be foundjava.io.IOException
- If there are insufficient resources to perform the registration.EventPermission
,
unregisterApplication(String, String)
public void unregisterApplication(java.lang.String event, java.lang.String application)
event
- The name of the event from which the application is to be
unregistered; if event
contains a final "*",
the listener will match any event name with identical prefix
(without the "*").application
- The fully qualified class name of the application to be
unregistered.java.lang.NullPointerException
- If application
or event
is
null
.java.lang.IllegalArgumentException
- If application
does not refer to a valid
applicationEventPermission
,
registerApplication(String, String, boolean)
Copyright (c) 2014, Oracle and/or its affiliates. All Rights Reserved. Use of this specification is subject to license terms.