J2ME 技術(shù)的學(xué)習(xí)與實(shí)踐者

          [導(dǎo)入]OpenBaseMovil 設(shè)備檢測(cè)(2)


          網(wǎng)站: JavaEye  作者: iwinyeah  鏈接:http://iwinyeah.javaeye.com/blog/169545  發(fā)表時(shí)間: 2008年03月09日

          聲明:本文系JavaEye網(wǎng)站發(fā)布的原創(chuàng)博客文章,未經(jīng)作者書(shū)面許可,嚴(yán)禁任何網(wǎng)站轉(zhuǎn)載本文,否則必將追究法律責(zé)任!

          唉,有貼代碼騙糧票的嫌疑呢,至少大家可以在這里看到各種設(shè)備的規(guī)格方法了.
              public static boolean isBlackBerry()
              {
                  return checkPlatform( "RIM" );
              }
          
              public static boolean checkPlatform( final String key )
              {
                  final String platform = System.getProperty( "microedition.platform" );
                  return platform != null && platform.toUpperCase().indexOf(
                          key.toUpperCase()
                  ) > -1;
              }
          
              public static boolean checkUserAgent( final String key )
              {
                  final String userAgent = Application.getManager().getProperty(
                          "user-agent"
                  );
                  return userAgent != null && userAgent.toUpperCase().indexOf(
                          key.toUpperCase()
                  ) > -1;
              }
          
              public static boolean checkPlatform( final String[] keys )
              {
                  final int length = keys.length;
                  for( int i = 0; i < length; i++ )
                  {
                      if( checkPlatform( keys[i] ) )
                      {
                          return true;
                      }
                  }
                  return false;
              }
          
              public static boolean isNokia()
              {
                  return checkPlatform( "Nokia" );
              }
          
              public static boolean isEmulator()
              {
                  return checkPlatform( new String[] { "j2me", "SunMicrosystems_wtk" } );
              }
          
              public static boolean isSonyEricsson()
              {
                  return checkPlatform( "SonyEricsson" );
              }
          
              public static boolean isSonyEricssonJP7()
              {
                  return isSonyEricsson() && checkPlatform( JP7 );
              }
          
              public static boolean isSymbian()
              {
                  return checkUserAgent( "SymbianOS" );
              }
          
              public static boolean isSeries60()
              {
                  return checkUserAgent( "Series60" );
              }
          
              public static boolean isSeries60_2nd()
              {
                  return checkUserAgent( "Series60/2" );
              }
          
              public static boolean isSeries60_3rd()
              {
                  return checkUserAgent( "Series60/3" );
              }
          

          本文的討論也很精彩,瀏覽討論>>


          JavaEye推薦




          文章來(lái)源:http://iwinyeah.javaeye.com/blog/169545

          posted on 2008-03-09 18:55 iwinyeah 閱讀(57) 評(píng)論(0)  編輯  收藏


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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 勐海县| 定边县| 佳木斯市| 凤庆县| 阳东县| 平乡县| 英吉沙县| 扎囊县| 怀宁县| 陆良县| 梅河口市| 鄯善县| 海林市| 丽水市| 大冶市| 渝北区| 常德市| 蒙山县| 雷波县| 云浮市| 南江县| 灵璧县| 黄浦区| 张掖市| 安岳县| 九江县| 兴海县| 揭东县| 香港 | 石门县| 左云县| 柳林县| 玉门市| 临桂县| 石景山区| 阜阳市| 灵台县| 滦南县| 泗洪县| 巴塘县| 绵阳市|