0
点赞
收藏
分享

微信扫一扫

Android开发判断是否为鸿蒙系统

IT影子 2022-05-16 阅读 74
public static boolean isHarmonyOs(){
try {
Class<?> buildExClass = Class.forName("com.huawei.system.BuildEx");
Object osBrand = buildExClass.getMethod("getOsBrand").invoke(buildExClass);
return "harmony".equalsIgnoreCase(osBrand.toString());
}catch (Throwable e){
return false;
}
}




举报

相关推荐

0 条评论