前言
欢迎大家我分享和推荐好用的代码段~~
声明
欢迎转载,但请保留文章原始出处:
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;
}
}
Android 普通APP APK 如何确认系统是MTK 平台