Android 依据Build相关信息判断机型

本文主要通过Build的相关信息获取机型,目前机型判断的较少,后续继续维护更新

public static String parseBuild() {StringBuilder sb = new StringBuilder();String deriveFingerprint = Build.FINGERPRINT;String manufacturer = Build.MANUFACTURER;if (!TextUtils.isEmpty(deriveFingerprint)&& !TextUtils.equals(deriveFingerprint, Build.UNKNOWN)) {sb.append(deriveFingerprint.toLowerCase(Locale.US));}if (!TextUtils.isEmpty(manufacturer)&& !TextUtils.equals(manufacturer, Build.UNKNOWN)) {sb.append(",");sb.append(manufacturer.toLowerCase(Locale.US));}return sb.toString();}public static String getRom(){String s = parseBuild();if (TextUtils.isEmpty(s)){return "";}if (s.contains("xiaomi"))return "xiaomi";if (s.contains("samsung"))return "samsung";if (s.contains("vivo"))return "vivo";if (s.contains("oppo"))return "oppo";if (s.contains("realme"))return "realme";if (s.contains("meizu")) return "meizu";if (s.contains("huawei") || s.contains("honor") ) {if (s.contains("honor")) {return "honor";}return "huawei";}if (s.contains("oneplus")) return "oneplus";if (s.contains("lenovo")) return "lenovo";return "";}