Skip to content

小米设备存在隐藏代码可否新增 #203

@Caij

Description

@Caij
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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions