-
Notifications
You must be signed in to change notification settings - Fork 456
Open
Description
public static String getDeviceName() {
String deviceName = "";
try {
Class SystemProperties = Class.forName("android.os.SystemProperties");
Method get = SystemProperties.getDeclaredMethod("get", String.class, String.class);
deviceName = (String) get.invoke(SystemProperties, "ro.product.marketname", "");
} catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException | ClassNotFoundException e) {
e.printStackTrace();
}
return deviceName;
}
这样获取的代码部分机型和android.os.Build.MODEL一样,部分机型又不一样,小米比较混乱。
Metadata
Metadata
Assignees
Labels
No labels