<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    饒榮慶 -- 您今天UCWEB了嗎?--http://www.ucweb.com

    3G 手機(jī)開發(fā)網(wǎng)

       :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
      99 Posts :: 1 Stories :: 219 Comments :: 0 Trackbacks
    原文地址

    相信做手機(jī)開發(fā)的都知道,write once debug anywhere。你向從中體驗(yàn)樂趣嗎,那先來了解下手機(jī)對JSR規(guī)范的支持吧。
    下面是我從網(wǎng)絡(luò)上獲取一些的信息。
    其中一個源代碼出自http://www.javaeye.com/topic/75387
    大家可以到上面下載源代碼,然后稍微修改下,就可以提供對jsr的更多測試了。
    關(guān)于測試的方面看下面

    For instance, the property microedition.commports is present in the MIDP 2.0 specification. Its value is a comma-separated list of ports you can use to build a URL, which the Generic Connection Framework can in turn use to create a javax.microedition.io.CommConnection object.
    To query system properties use java.lang.System.getProperty(), as in:

    import java.lang.*;

    String value;
    String key = "microedition.pim.version";

    value = System.getProperty( key );
    ...



    This table lists the defined system properties, drawing them from JSRs that are in the public review, final ballot, or final state, as defined in the Java Community Process (JCP):

    J2ME Defined System Properties

    JSR Property Name
    Default Value¹
    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.commports (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)
    211 CHAPI-Version 1.0

    這個是e文的

    看看中文的吧

    2.3.4 MIDP應(yīng)用程序的屬性

    MIDlet可以訪問兩種運(yùn)行時的屬性值:系統(tǒng)屬性和應(yīng)用程序?qū)傩浴?/font>

    1.系統(tǒng)屬性

    系統(tǒng)屬性是在CLDC(Connected Limited Device Configuration)中定義的,屬性值被寫入底層的系統(tǒng),我們可以讀取它們,但是不能修改這些屬性值。如果想讀取一個系統(tǒng)屬性值,那么可以使用System類的靜態(tài)方法System.getProperty()來讀取。有時候我們可能想讀取特定手機(jī)的系統(tǒng)信息,比如IMEI號。解決辦法就是去參考這款手機(jī)的開發(fā)指南和規(guī)范,比如,從SonyEricsson系列手機(jī)讀取IMEI號,調(diào)用方法:System.getProperty ("com. onyericsson.imei"),這時將返回手機(jī)的IMEI號碼,如IMEI 123456-00-123456-1-00。需要說明的一點(diǎn)是,在SonyEricsson P910上查詢IMEI號碼時,傳遞的字符串參數(shù)應(yīng)該是com.sonyericsson.IMEI(IMEI須大寫)。如果在不支持此項(xiàng)功能的手機(jī)上查詢IMEI號時,將什么都不返回,例如,在T610上調(diào)用。

    表2-3列舉了系統(tǒng)屬性。

    表2-3 MIDP應(yīng)用程序系統(tǒng)屬性

    JSR

    屬性名稱

    認(rèn)

    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

    依賴于底層實(shí)現(xiàn)


    microedition.pim.version

    1.0

    118

    microedition.locale

    null


    microedition.profiles

    MIDP-2.0


    microedition.commports

    依賴于底層實(shí)現(xiàn)


    microedition.hostname

    依賴于底層實(shí)現(xiàn)

    120

    wireless.messaging.sms.smsc

    依賴于底層實(shí)現(xiàn)

    139

    microedition.platform

    依賴于底層實(shí)現(xiàn)


    microedition.encoding

    ISO8859-1


    microedition.configuration

    CLDC-1.1


    microedition.profiles

    依賴于底層實(shí)現(xiàn)

    177

    microedition.smartcardslots

    依賴于底層實(shí)現(xiàn)

    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

    依賴于底層實(shí)現(xiàn)


    microedition.profiles

    IMP-1.0

    205

    wireless.messaging.sms.smsc

    依賴于底層實(shí)現(xiàn)

    205

    wireless.messaging.mms.mmsc

    依賴于底層實(shí)現(xiàn)

    2.應(yīng)用程序?qū)傩?/font>

    應(yīng)用程序?qū)傩灾凳窃趹?yīng)用程序描述符文件或者M(jìn)ANIFEST文件中定義的,當(dāng)我們部署應(yīng)用程序的時候可以定義應(yīng)用程序?qū)傩浴1热缦旅媸且粋€典型的JAD文件內(nèi)容。

    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

    其中Which-Locale就是應(yīng)用程序?qū)傩灾担覀兛梢酝ㄟ^MIDlet的成員方法getAppProperty()來得到它,代碼片斷如下:

    import javax.microedition.midlet.*;

    public class MyMIDlet extends MIDlet {

    private String suiteName;

    private String which_locale;

    public MyMIDlet(){

    suiteName = getAppProperty( "MIDlet-Name" );

    which_locale = getAppProperty("Which-Locale");

    }

    //這里省略了其他代碼

    }

    屬性值對大小寫是敏感的,如果屬性值在底層系統(tǒng)、JAD文件和Manifest文件中都沒有定義的話,那么將返回Null。

    熟悉MIDP應(yīng)用程序的系統(tǒng)屬性對我們開發(fā)靈活、強(qiáng)大的MIDlet至關(guān)重要。可以根據(jù)系統(tǒng)屬性返回值來動態(tài)地生成應(yīng)用程序的菜單。例如,通過判斷底層系統(tǒng)是否支持MMAPI來決定應(yīng)用程序中是否要添加攝像功能。下面的例子演示了如何在MIDlet中讀取系統(tǒng)屬性。

    package com.j2medev.ch3.property;

    import javax.microedition.lcdui.*;

    import javax.microedition.midlet.*;

    public class DetectMIDlet extends MIDlet {

    private static DetectMIDlet instance = null;

    private Display display = null;

    private Displayable form = null;

    public DetectMIDlet() {

    instance = this;

    }

    protected void startApp() {

    if(display==null) {

    //首次啟動應(yīng)用程序

    display = Display.getDisplay(this);

    form = new TestForm();

    display.setCurrent(form);

    } else{

    display.setCurrent(form);

    }

    }

    protected void pauseApp() {}

    protected void destroyApp(boolean unconditional) {}

    public static void quitApp() {

    instance.destroyApp(true);

    instance.notifyDestroyed();

    instance = null;

    }

    }

    class TestForm extends Form implements CommandListener {

    private Command exit = new Command("退出", Command.EXIT, 0);

    public TestForm() {

    super("J2ME平臺測試");

    String s;

    //CLDC版本屬性

    s = System.getProperty("microedition.configuration");

    append(getValue("CLDC版本", s));

    //MIPD版本屬性

    s = System.getProperty("microedition.profiles");

    append(getValue("MIDP版本",s));

    s = System.getProperty("microedition.platform");

    append(getValue("軟件平臺", s));

    s = System.getProperty("microedition.encoding");

    append(getValue("系統(tǒng)編碼", s));

    s = System.getProperty("microedition.locale");

    append(getValue("區(qū)域設(shè)置", s));

    s = System.getProperty("microedition.jtwi.version");

    append(getValue("JTWI", s));

    //判斷是否支持MMAPI

    s = System.getProperty("microedition.media.version");

    append(getValue("MMAPI", s));

    //判斷是否支持WMA

    s = System.getProperty("wireless.messaging.sms.smsc");

    if(s!=null) {

    append(getValue("WMA", "支持"));

    append(getValue("SMS", s));

    s = System.getProperty("wireless.messaging.mms.mmsc");

    append(getValue("MMS", s));

    } else

    append(getValue("WMA", null));

    //判斷是否支持藍(lán)牙

    s = System.getProperty("bluetooth.api.version");

    append(getValue("藍(lán)牙", s));

    //判斷是否支持個人信息管理

    s = System.getProperty("microedition.pim.version");

    append(getValue("PIM", s));

    //判斷是否支持文件系統(tǒng)

    s=System.getProperty("microedition.io.file.FileConnection. version");

    append(getValue("FileConnection", s));

    //判斷是否支持SIP

    s = System.getProperty("microedition.sip.version");

    append(getValue("SIP", s));

    //判斷是否支持M3G JSR 184

    s = System.getProperty("microedition.m3g.version");

    append(getValue("M3G", s));

    addCommand(exit);

    setCommandListener(this);

    }

    private String getValue(String prompt, String s) {

    return prompt + ":" + (s==null ? "不支持" : s) + "\n";

    }

    public void commandAction(Command c, Displayable d) {

    if(c==exit){

    DetectMIDlet.quitApp();

    }

    }

    }

    DetectMIDlet的運(yùn)行界面如圖2-19所示。

    圖2-19 DetectMIDlet的運(yùn)行界面


    這篇文章只是整理這方面的知識,并不是原創(chuàng)。所以大家湊合著看吧





    爬蟲工作室 -- 專業(yè)的手機(jī)軟件開發(fā)工作室
    3G視線 -- 專注手機(jī)軟件開發(fā)
    posted on 2007-08-28 21:59 3G工作室 閱讀(1570) 評論(1)  編輯  收藏

    Feedback

    # re: 手機(jī)J2ME環(huán)境測試程序--測試手機(jī)對jsr的支持以及其他信息 2007-08-29 21:43 張武科
    工作
      回復(fù)  更多評論
      


    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 午夜视频在线在免费| 亚洲va无码va在线va天堂| 巨胸狂喷奶水视频www网站免费| 国产亚洲av片在线观看16女人| 国产精品永久免费10000| 最近中文字幕无免费视频| 亚洲综合网美国十次| 国产精品无码素人福利免费| 亚洲性色AV日韩在线观看| 久久久久亚洲精品天堂久久久久久 | 美女露隐私全部免费直播| 日韩免费一区二区三区| 中文字幕免费在线看线人动作大片| 亚洲人成影院在线高清| 国外亚洲成AV人片在线观看| 99久久免费国产特黄| 亚洲第一精品福利| 国产免费拔擦拔擦8x| 精品一区二区三区免费毛片爱| 久久精品夜色国产亚洲av| 亚洲av无码成人精品区| 亚洲综合久久成人69| 亚洲色欲色欲www在线播放| 久久亚洲精品无码网站| 亚洲熟妇丰满多毛XXXX| 最近2019中文字幕免费看最新| 国精产品一区一区三区免费视频| 亚洲AV日韩AV无码污污网站| 亚洲精品成人av在线| 亚洲精品一级无码鲁丝片| 午夜在线免费视频| 亚洲熟女乱色一区二区三区| 自怕偷自怕亚洲精品| 免费观看黄网站在线播放| 国产精品99精品久久免费| 亚洲AV色吊丝无码| 国产片免费福利片永久| 青青在线久青草免费观看| 亚洲免费精彩视频在线观看| 中国国语毛片免费观看视频| 黄页网址大全免费观看12网站|