MIDlet is an application model proposed in MIDP, which is currently the most widely used in j2s. This article describes attributes of the MIDP application. For more information, see MIDP application properties.
The MIDlet can access the attribute values of two types of runtime: system and application.
The concept of system attributes is defined in cldc (connected limited device configuration). attribute values are written to the underlying system, which can be read but cannot be modified. If you want to read a system property value, you can use system class static method system. getproperty () to read. Some netizens often ask how to read the mobile phone number or IMEI number. In fact, you should refer to the development documents of specific models. Different vendors have different implementations. To make it easier for you to find out the system property values defined in j2s, if your mobile phone supports related JSR, you can obtain the property values through the above method.
JSR |
Property name |
Default Value limit |
30 |
Microedition. Platform |
Null |
|
Microedition. Encoding |
Iso8859_1 |
|
Microedition. Configuration |
CLDC-1.0 |
|
Microedition. Profiles |
Null |
37 |
Microedition. locale |
Null |
|
Microedition. Profiles |
MIDP-1.0 |
75 |
Microedition. Io. file. fileconnection. Version |
1.0 |
|
File. Separator |
(Impl-dep) |
|
Microedition. Pim. Version |
1.0 |
118 |
Microedition. locale |
Null |
|
Microedition. Profiles |
MIDP-2.0 |
|
Microedition. commp orts |
(Impl-dep) |
|
Microedition. hostname |
(Impl-dep) |
120 |
Wireless. messaging. SMS. SMSC |
(Impl-dep) |
139 |
Microedition. Platform |
(Impl-dep) |
|
Microedition. Encoding |
ISO8859-1 |
|
Microedition. Configuration |
CLDC-1.1 |
|
Microedition. Profiles |
(Impl-dep) |
177 |
Microedition. smartcardslots |
(Impl-dep) |
179 |
Microedition. Location. Version |
1.0 |
180 |
Microedition. Sip. Version |
1.0 |
184 |
Microedition. M3G. Version |
1.0 |
185 |
Microedition. jtwi. Version |
1.0 |
195 |
Microedition. locale |
(Impl-dep) |
|
Microedition. Profiles |
Imp-1.0 |
205 |
Wireless. messaging. SMS. SMSC |
(Impl-dep) |
205 |
Wireless. messaging. mms. mmsc |
(Impl-dep) |
The application property value is defined in the application descriptor file or manifest file (the manifest file is packaged in the jar file). When we deploy the application, the application property is defined. For example, the following is a typical JAD file content:
MIDlet-1: httpwrappermidlet, httpwrapper. httpwrappermidlet
MIDlet-jar-size: 16315
MIDlet-jar-URL: httpwrapper. Jar
MIDlet-Name: httpwrapper
MIDlet-vendor: vendor
MIDlet-version: 1.0
Microedition-configuration: CLDC-1.0
Microedition-profile: MIDP-1.0
Which-locale: En
Where which-locale is the application property value. We can get it through the member method getappproperty () of the MIDlet. The code snippet is as follows:
import javax.microedition.midlet.*;public class MyMIDlet extends MIDlet {private String suiteName;public MyMIDlet(){suiteName = getAppProperty( "MIDlet-Name" );... // more stuff}... // etc.}
The attribute value is case sensitive. If the attribute value is not defined in the system, JAD file, or manifest file, null is returned. If the same attribute value is defined in the JAD file and manifest file, the following two situations may occur: if the application is a trusted application of midp2.0, AMS will reject the installation. Otherwise, the property value in the JAD file overwrites the value in manifest.
Using Attribute values in a JAD file has some benefits. If you need to change some data without re-compiling code or packaging, you can define some attribute values in Jad. In this way, you can configure your application and think about whether it is similar to using attribute files in j2se applications. However, do not define a large amount of data in Jad, because many devices have restrictions on the size of Jad files.