[英]How to get the custom ROM/Android OS Name from Android programatically
我希望从设备接收自定义 ROM/Android 操作系统名称,例如假设设备是:
OPPO -> ColorOS
一加-> OxygenOS
华为-> HarmonyOS
我也使用了以下方法,但没有成功。
Build.DISPLAY
-> ONEPLUS A6003_22_201116
Build.VERSION.BASE_OS
-> "" // 返回空字符串
System.getProperty("os.name")
-> Linux
System.getProperty("os.version")
-> 4.9.179-perf+
System.getProperty("ro.modversion")
-> null // 返回 null
您可以通过以下方法查看并获取HarmonyOS:
public static boolean isHarmony(Context context) {
try {
int id = Resources.getSystem().getIdentifier("config_os_brand", "string", "android");
return context.getString(id).equals("harmony");
} catch (Exception e) {
return false;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.