Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MIUI 9之后,以前的方法无效,统一成原生的方法了 #7

Open
ditclear opened this issue Dec 13, 2018 · 0 comments
Open

Comments

@ditclear
Copy link

见文档: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;
        }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant