We often need to interact with the mobile phone system to obtain system-related information. In the design of the j2s API, a series of system attributes are provided.
Table 1 attributes of cldc, MIDP, and jtwi
Attribute name |
Attribute function |
Microedition. Profiles |
Represents the MIDP version supported by the phone, returns a format Value of "MIDP-1.0" or "MIDP-2.0" |
Microedition. Configuration |
Represents the cldc version supported by the phone and returns a format Value of "CLDC-1.0" or "CLDC-2.0" |
Microedition. locale |
Indicates the country or region of the mobile phone. The returned value is in the format of "En-us" |
Microedition. Platform |
Indicates the brand and model of the mobile phone. The return value format of the Nokia mobile phone is "nokia6310i/4.42" |
Microedition. Encoding |
Represents the phone's default Character Set Name, the return value format is "ISO-8859-1" |
Microedition. commp orts |
Indicates the list of serial ports that can be used by the mobile phone. The return values are separated by commas (,). |
Microedition. hostname |
The midp2.0 definition represents the name of the local host, which must be supported by the mobile phone. |
Microedition. jtwi. Version |
Indicates the jtwi version supported by the mobile phone. The value must be "1.0" |
Table 2 Optional package attributes
Attribute name |
Attribute function |
Microedition. Media. Version |
Indicates the mmapi version supported by the mobile phone. If not, null is returned. |
Microedition. Pim. Version |
Indicates the pim api version supported by the mobile phone. If not, null is returned. |
Microedition. M3G. Version |
Indicates the M3G API version supported by the mobile phone. If not, null is returned. |
Microedition. Location. Version |
Indicates the location API version supported by the mobile phone. If not, null is returned. |
Bluetooth. API. Version |
Indicates the bt api version supported by the mobile phone. If not, null is returned. |
Microedition. Io. file. fileconnection. Version |
Indicates the version of the fc api supported by the mobile phone. If not, null is returned. |
Microedition. Global. Version |
Represents the mobile internationalization API (JSR-238) version supported by the phone, and returns NULL if not supported |
Microedition. chapi. Version |
Indicates the CH (content handler) API (jsr211) version supported by the mobile phone. If not, null is returned. |
Microedition. Sip. Version |
Indicates the version of the sip api supported by the mobile phone. If not, null is returned. |
Table 3 mmapi attributes
Attribute name |
Attribute function |
Supports. Mixing |
Indicates whether the mobile phone supports sound mixing (multiple players can be played at the same time). The return value is "true" or "false" |
Supports. Audio. Capture |
Indicates whether the mobile phone supports sound capture (recording). The return value is "true" or "false" |
Supports. Video. Capture |
Indicates whether the mobile phone supports video capture (video recording). The returned value is "true" or "false" |
Supports. Recording |
Indicates whether the mobile phone supports record. The returned value is "true" or "false" |
Audio. encodings |
The audio format supported by the mobile phone. The return value is in the format of "encoding = audio/WAV". Separate multiple formats with at least one space. |
Video. encodings |
Indicates the video format supported by the mobile phone. The returned value format is "encoding = video/3GPP". At least one space is used to separate multiple formats. |
Video. snapshot. encodings |
The format of the Video Snapshot obtained by the mobile phone using the getsnapshot method. The returned value is in the format of "encoding = PNG". At least one space is used to separate multiple formats. |
Streamable. Contents |
Indicates the streaming media format supported by the mobile phone. If the return value is null, the streaming media format is not supported. |
Table 4 wireless messaging API attributes
Attribute name |
Attribute function |
Wireless. messaging. SMS. SMSC |
Indicates the number of the SMS service center when a mobile phone is sent. |
Table 5 fileconnection API
Attribute name |
Attribute function |
Fileconn. dir. Photos |
The directory that stores photos and other images on your mobile phone, for example, "file: // C:/my files/images /" |
Fileconn. dir. Videos |
Indicates the directory where videos are stored on the mobile phone, for example, "file: // C:/my files/Video Clips /" |
Fileconn. dir. tones |
Indicates the directory where the audio is stored in the mobile phone, for example, "file: // C:/my files/tones /" |
Fileconn. dir. memorycard |
Represents the root directory of the memory card on your phone. For example, "file: // D :/" |
Fileconn. dir. Private (Not supported by Nokia s40) |
Indicates the private working directory of the MIDlet in the mobile phone, for example, "file: // C:/system/midlets/[1015f294]/scratch" |
Fileconn. dir. Photos. Name |
Indicates the name of the image directory in the mobile phone, for example, "Images" |
Fileconn. dir. Videos. Name |
The name of the video directory in the mobile phone, for example, "video clips" |
Fileconn. dir. tones. Name |
Indicates the name of the audio directory in the mobile phone, such as "sound clips" |
File. Separator |
Represents the file Separator in the mobile phone, such as "/" |
Fileconn. dir. memorycard. Name |
Indicates the name of the memory card in the mobile phone, for example, "Memory Card" |
Using these attributes, you can obtain a lot of system-related information required during the program running, or you can use the attributes in Table 2 to obtain information such as whether the mobile phone supports the corresponding Optional package.
Example: string name = system. getproperty ("microedition. Platform ");
Note: If you need to obtain information in the JVM or JAD file, you need to use the getappproperty method in the MIDlet class. For the attribute name, you need to check the setting of the JAD file, which is irrelevant to the attribute name described in this article.