获取Android 的Rom信息,以及判断是否为MIUI及获取MIUI版本

//BOARD 主板
String phoneInfo = "BOARD: " + android.os.Build.BOARD;
phoneInfo += ", BOOTLOADER: " + android.os.Build.BOOTLOADER;
//BRAND 运营商
phoneInfo += ", BRAND: " + android.os.Build.BRAND;
phoneInfo += ", CPU_ABI: " + android.os.Build.CPU_ABI;
phoneInfo += ", CPU_ABI2: " + android.os.Build.CPU_ABI2;
//DEVICE 驱动
phoneInfo += ", DEVICE: " + android.os.Build.DEVICE;
//DISPLAY Rom的名字 例如 Flyme 1.1.2(魅族rom)  JWR66V(Android nexus系列原生4.3rom)
phoneInfo += ", DISPLAY: " + android.os.Build.DISPLAY;
//指纹
phoneInfo += ", FINGERPRINT: " + android.os.Build.FINGERPRINT;
//HARDWARE 硬件
phoneInfo += ", HARDWARE: " + android.os.Build.HARDWARE;
phoneInfo += ", HOST: " + android.os.Build.HOST;
phoneInfo += ", ID: " + android.os.Build.ID;
//MANUFACTURER 生产厂家
phoneInfo += ", MANUFACTURER: " + android.os.Build.MANUFACTURER;
//MODEL 机型
phoneInfo += ", MODEL: " + android.os.Build.MODEL;
phoneInfo += ", PRODUCT: " + android.os.Build.PRODUCT;
phoneInfo += ", RADIO: " + android.os.Build.RADIO;
phoneInfo += ", RADITAGSO: " + android.os.Build.TAGS;
phoneInfo += ", TIME: " + android.os.Build.TIME;
phoneInfo += ", TYPE: " + android.os.Build.TYPE;
phoneInfo += ", USER: " + android.os.Build.USER;
//VERSION.RELEASE 固件版本
phoneInfo += ", VERSION.RELEASE: " + android.os.Build.VERSION.RELEASE;
phoneInfo += ", VERSION.CODENAME: " + android.os.Build.VERSION.CODENAME;
//VERSION.INCREMENTAL 基带版本
phoneInfo += ", VERSION.INCREMENTAL: " + android.os.Build.VERSION.INCREMENTAL;
//VERSION.SDK SDK版本
phoneInfo += ", VERSION.SDK: " + android.os.Build.VERSION.SDK;

phoneInfo += ", VERSION.SDK_INT: " + android.os.Build.VERSION.SDK_INT;



参考Android源码:

https://code.google.com/p/cyanogen-updater/source/browse/trunk/src/cmupdaterapp/utils/SysUtils.java#19


在Android shell模式下输入 getprop 就能获取系统属性值

如果Rom是miUI那么就会有以下字段.

 [ro.miui.ui.version.code]: [3]
[ro.miui.ui.version.name]: [V5] 

那么只要用一下代码获取就能知道是不是UI了. 

getSystemProperty("ro.miui.ui.version.name")

public static String getSystemProperty(String propName){
            String line;
            BufferedReader input = null;
    try
    {
            Process p = Runtime.getRuntime().exec("getprop " + propName);
        input = new BufferedReader(new InputStreamReader(p.getInputStream()), 1024);
        line = input.readLine();
        input.close();
    }
    catch (IOException ex)
    {
            Log.e(TAG, "Unable to read sysprop " + propName, ex);
            return null;
    }
    finally
    {
            if(input != null)
            {
                            try
                            {
                                    input.close();
                            }
                            catch (IOException e)
                            {
                                    Log.e(TAG, "Exception while closing InputStream", e);
                            }
            }
    }
    return line;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值