J2ME 技術(shù)的學習與實踐者

          [導入]OpenBaseMovil 設備檢測(2)


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

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

          唉,有貼代碼騙糧票的嫌疑呢,至少大家可以在這里看到各種設備的規(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推薦




          文章來源:http://iwinyeah.javaeye.com/blog/169545

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


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


          網(wǎng)站導航:
           
          主站蜘蛛池模板: 秀山| 文成县| 黔东| 罗定市| 安仁县| 洛浦县| 淅川县| 安庆市| 正宁县| 闸北区| 孟津县| 弥勒县| 定兴县| 开封县| 进贤县| 如皋市| 定州市| 西贡区| 加查县| 华宁县| 施秉县| 雅安市| 安乡县| 临颍县| 东海县| 措美县| 霍山县| 海淀区| 榆中县| 大化| 诸城市| 山丹县| 滕州市| 手游| 高唐县| 麻栗坡县| 靖宇县| 营山县| 确山县| 新兴县| 双峰县|