Android 普通APP APK 如何確認系統是MTK 平台

來源:互聯網
上載者:User

標籤:google   frameworks   csdn   apk   android   

前言
         歡迎大家我分享和推薦好用的程式碼片段~~
聲明
         歡迎轉載,但請保留文章原始出處:
         CSDN:http://www.csdn.net
         雨季o莫憂離:http://blog.csdn.net/luckkof

本文

 

[Description]
普通APP APK 如何確認系統是MTK 平台
[Keyword]
APP APK MTK 平台 System Property
[Solution]
有一些APP 廠商,可能針對MTK 平台進行最佳化設計,那麼普通APP 如何確認系統是MTK 平台呢?
目前在手機運行系統中,要能夠直接判斷是MTK 系統,可以讀取下面的system property.
Java API
android.os.SystemProperties
public String get(String key);
public String get(String key, String def);
 
可以讀取下面的三個MTK 平台專屬的system property, 有即是MTK 平台了,並且可以擷取具體的MTK 平台釋放資訊。
ro.mediatek.platform          對應MTK IC, 注意不區分2G,3G, 如MT6575/MT6515 都統一會是MT6575
ro.mediatek.version.branch    對應MTK 內部branch, 如ALPS.ICS.MP,  ALPS.ICS2.MP, ALPS.JB.MP 等之類
ro.mediatek.version.release   對應MTK 內部branch 的釋放版本,如ALPS.ICS.MP.V2.47, ALPS.JB2.MP.V1.9
 
如ICS2 75 的手機
[ro.mediatek.platform]: [MT6575]
[ro.mediatek.version.branch]: [ALPS.ICS.MP]
[ro.mediatek.version.release]: [ALPS.ICS.MP.V2.47]
 
JB2.MP 89 的手機
[ro.mediatek.platform]: [MT6589]
[ro.mediatek.version.branch]: [ALPS.JB2.MP]
[ro.mediatek.version.release]: [ALPS.JB2.MP.V1.9] 下面是一個demo 的util java class. import android.os.SystemProperties;/**
* A simple util demo for Mediatek Platform Information
*/
public class MediatekPlatformUtil{   public static final String MTK_PLATFORM_KEY = "ro.mediatek.platform";
  public static final String MTK_VERSION_BRANCH_KEY = "ro.mediatek.version.branch";
  public static final String MTK_VERSION_RELEASE_KEY = "ro.mediatek.version.release";   /**
   * Check is or not Mediatek platfrom 
   */
  public static boolean isMediatekPlatform(){
    String platform = SystemProperties.get(MTK_PLATFORM_KEY);
    return platform != null && (platform.startsWith("MT") || platform.startsWith("mt"));
  }   /**
   * Get the Mediatek Platform information, such as MT6589, MT6577.....
   * @Warning It does not distinguish between 2G and 3G IC. IE. MT6515, MT6575 => MT6575
   */
  public static String getMediatekPlatform(){
    return SystemProperties.get(MTK_PLATFORM_KEY);
  }   /**
   * Get the mediatek version information.
   * Return a string array with two elements. first element is branch, and the second is release version.
   */
  public static String[] getMediatekVersion(){
    String[] result = new String[2];
    result[0] = SystemProperties.get(MTK_VERSION_BRANCH_KEY);
    result[1] = SystemProperties.get(MTK_VERSION_RELEASE_KEY);
    return result;
  } }

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.