Open ditclear opened 5 years ago
见文档:https://dev.mi.com/console/doc/detail?pId=1159 代码修改如下
// /** //// * 判断是否为MIUI6以上 //// */ //// public static boolean isMIUI6Later() { //// try { //// Class<?> clz = Class.forName("android.os.SystemProperties"); //// Method mtd = clz.getMethod("get", String.class); //// String val = (String) mtd.invoke(null, "ro.miui.ui.version.name"); //// val = val.replaceAll("[vV]", ""); //// int version = Integer.parseInt(val); //// return version >= 6; //// } catch (Exception e) { //// return false; //// } //// } /** * 判断是否为MIUI6以上9以下 */ public static boolean isMIUI6LaterAnd9Before() { try { Class<?> clz = Class.forName("android.os.SystemProperties"); Method mtd = clz.getMethod("get", String.class); String val = (String) mtd.invoke(null, "ro.miui.ui.version.name"); val = val.replaceAll("[vV]", ""); int version = Integer.parseInt(val); return version >= 6 && version < 9; } catch (Exception e) { return false; } }
见文档:https://dev.mi.com/console/doc/detail?pId=1159 代码修改如下