public abstract class MIDlet
extends java.lang.Object
MIDlet
(the name comes from MIDP, this application model has
been developed for) to allow the application management software to
control the application and to be able to
retrieve properties from the application
descriptor and notify and request state changes. The methods of the class
MIDlet
allow the application management software to create,
start, and destroy an application.
An application is a set of classes designed to be run
and controlled by the application management software via this interface. The
states allow the application management software to manage the activities of
an application. It can select which application is active at a given time by
starting and destroying them individually. The application management
software maintains the state of the application and
invokes methods on the MIDlet
class
to notify the application of change states.
The application implements these
methods to update its internal activities and
resource usage as directed by the application management software. The
application can initiate some state changes itself and notifies the application
management software of those state changes by invoking the appropriate methods.
Note: Some of the methods on this class signal state changes. The state change is not considered complete until the state change method has returned. It is intended that these methods return quickly.
Modifier | Constructor and Description |
---|---|
protected |
MIDlet()
Protected constructor for subclasses.
|
Modifier and Type | Method and Description |
---|---|
int |
checkPermission(java.lang.String permission)
Deprecated.
MEEP does support named permissions only for legacy applications.
As a consequence, this method is deprecated and only still there for the
sake of backward compatibility with IMP-NG.
The named permissions of IMP-NG have been deprecated. For MEEP applications,
calling Gets the status of the specified legacy named permission. If no API on the device defines the specific permission requested then it MUST be reported as denied. If the status of the permission is not known for some reason, it should be reported as unknown. |
protected abstract void |
destroyApp(boolean unconditional)
Signals the application to terminate and enter the
Destroyed state.
|
java.lang.String |
getAppProperty(java.lang.String key)
Provides an application with a mechanism to retrieve named properties from
the application management software.
|
static java.lang.String[] |
getAppProperty(java.lang.String name,
java.lang.String vendor,
java.lang.String attributeName,
java.lang.String attributeDelimiter)
Provides an application with a mechanism to retrieve and at the same time
parse application property values from the application descriptor and the
manifest of the application or bound LIBlets.
|
void |
notifyDestroyed()
Used by an application to notify the application management software that
it has entered into the Destroyed state.
|
void |
notifyPaused()
Deprecated.
This method is deprecated and MUST never been called.
|
protected void |
pauseApp()
Deprecated.
This method is deprecated and MUST never been called.
|
boolean |
platformRequest(java.lang.String URL)
Requests that the device handle (for example, display or install) the
indicated URL.
|
void |
resumeRequest()
Deprecated.
This method is deprecated and MUST never been called.
|
protected abstract void |
startApp()
Signals the application that it has entered the Active state.
|
protected MIDlet()
java.lang.SecurityException
- unless the application management software is creating the
application.protected abstract void startApp() throws MIDletStateChangeException
The use of MIDletStateChangeException
to delay starting an
application is deprecated. If
MIDletStateChangeException
is thrown
it MUST be handled as RuntimeException
below.
If a Runtime exception occurs during startApp
the
application will be destroyed immediately. Its destroyApp(boolean)
will
be called allowing the application to cleanup.
MIDletStateChangeException
- this exception is deprecated and MUST
never been thrown@Deprecated protected void pauseApp()
protected abstract void destroyApp(boolean unconditional) throws MIDletStateChangeException
Applications should perform any operations required before being terminated, such as releasing resources or saving preferences or state.
The use of MIDletStateChangeException
to delay destruction of an
application is deprecated. The destroyApp
method MUST always
be called with true
to force termination.
The application is put in the Destroyed
state regardless of how this method terminates.
If a Runtime exception occurs during destroyApp
then the
exception is ignored and the application is put into the Destroyed
state.
When an uncaught exception occurs in a thread, the thread MUST be stopped
in accordance with the Java Language Specification
[JLS]".
In addition, the destroyApp()
method of the application
that created the offending thread MAY be called.
unconditional
- MUST always be true
(just maintained for
compatibility reasonsMIDletStateChangeException
- this exception MUST never been thrownpublic final void notifyDestroyed()
destroyApp
method, and all resources held by the application will be considered
eligible for reclamation. The application must have performed the same
operations (clean up, releasing of resources etc.) it would have if the
destroyApp
method had been called.@Deprecated public final void notifyPaused()
public final java.lang.String getAppProperty(java.lang.String key)
key
- the name of the propertynull
is
returned if no value is available for the key.java.lang.NullPointerException
- is thrown if key
is null
.public static java.lang.String[] getAppProperty(java.lang.String name, java.lang.String vendor, java.lang.String attributeName, java.lang.String attributeDelimiter)
name
- name of the LIBlet or application to retrieve named property
information from. If both name and vendor are null
,
this retrieves information from the application JAD/Manifestvendor
- the vendor of the LIBlet or applicationattributeName
- the name of the property to retrieveattributeDelimiter
- The characters in this parameter are the
delimiters of separating the retrieved property value into
tokens. Delimiter characters themselves will not be treated
as tokens. If this is null
, the value is not
tokenized.null
is returned if no value is available for the
attributeName
.java.lang.NullPointerException
- is thrown if attributeName
is null
.@Deprecated public final void resumeRequest()
public final boolean platformRequest(java.lang.String URL) throws java.lang.Exception
This is a non-blocking method. In addition, this method does NOT queue multiple requests. On platforms where the application must exit before the request is handled, the platform MUST handle only the last request made. On platforms where the application and the request can be handled concurrently, each request that the applicatios makes MUST be passed to the platform software for handling in a timely fashion.
If the URL specified refers to an application (either an Application Descriptor or a JAR), the application handling the request MUST interpret it as a request to install the named package. In this case, the platform's normal application installation process SHOULD be used. If the application being installed is an update of the currently running application, the platform MUST first stop the currently running application before performing the update. If it is detected though that the update cannot be performed (missing dependencies or other reason avoiding the installation of the updated version of the application), then the existing version of the running application MUST NOT be stopped. On some platforms, the currently running application MAY need to be stopped before any installations can occur.
If the URL specified is of the form tel:<number>
,
as specified in RFC2806
, then the platform MUST interpret this as a request to initiate
a voice call. The request MUST be passed to the "phone"
application to handle if one is present in the platform. The
"phone" application, if present, MUST be able to set up
local and global phone calls and also perform DTMF post dialing. Not
all elements of RFC2806
need be implemented, especially the area-specifier or any other
requirement on the terminal to know its context. The isdn-subaddress,
service-provider and future-extension may also be ignored. Pauses during
dialing are not relevant in some telephony services.
Devices MAY choose to support additional URL schemes beyond the requirements listed above.
URL
- The URL for the platform to load. An empty string (not
null) cancels any pending requests.true
if the application MUST first exit before the
content can be fetched.java.lang.Exception
- MAY be thrown if the platform cannot handle the requestpublic final int checkPermission(java.lang.String permission) throws java.lang.IllegalStateException
The named permissions of IMP-NG have been deprecated. For MEEP applications,
calling checkPermission
throws an exception. For IMP(-NG)
applications, the implementation MUST implement checkPermission
though.
Gets the status of the specified legacy named permission. If no API on the device defines the specific permission requested then it MUST be reported as denied. If the status of the permission is not known for some reason, it should be reported as unknown.
permission
- to check if denied, allowed or unknown0
if the permission is denied, 1
if the
permission is allowed, -1
if the status is unknownjava.lang.IllegalStateException
- if the application suite is a MEEP application
suiteCopyright (c) 2014, Oracle and/or its affiliates. All rights reserved. Use of this specification is subject to license terms.