Android判断手机是否是小米MIUI系统的方法
程序员文章站
2024-02-22 14:41:58
废话不多说了,直接给大家贴代码了:
具体代码如下所示:
public class miuiutils {
// 检测miui
private s...
废话不多说了,直接给大家贴代码了:
具体代码如下所示:
public class miuiutils { // 检测miui private static final string key_miui_version_code = "ro.miui.ui.version.code"; private static final string key_miui_version_name = "ro.miui.ui.version.name"; private static final string key_miui_internal_storage = "ro.miui.internal.storage"; public static boolean ismiui() {<span style="white-space:pre"> </span>//获取缓存状态 if(sputils.getinstance().getcachedatasp().contains("ismiui")) { return sputils.getinstance().getcachedatasp().getboolean("ismiui",false); } properties prop= new properties(); boolean ismiui; try { prop.load(new fileinputstream(new file(environment.getrootdirectory(), "build.prop"))); } catch (ioexception e) { e.printstacktrace(); return false; } ismiui= prop.getproperty(key_miui_version_code, null) != null || prop.getproperty(key_miui_version_name, null) != null || prop.getproperty(key_miui_internal_storage, null) != null; sputils.getinstance().putcachedata("ismiui",ismiui);//保存是否miui return ismiui; }}
以上代码是基于android判断手机是否是小米minu系统的方法,希望对大家有所帮助!