天天看點

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

前言

         歡迎大家我分享和推薦好用的代碼段~~

聲明

         歡迎轉載,但請保留文章原始出處:

         CSDN:

         雨季o莫憂離:

正文

[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;

}