How to detect system information like os or device type

后端 未结 7 2194
不思量自难忘°
不思量自难忘° 2020-11-27 11:17

The most important things I want to know are the device type, the OS version, if it has a hardware keyboard and maybe the screen resolution. but if you know other useful deb

7条回答
  •  遥遥无期
    2020-11-27 11:50

    Try this to get Device Information.

    String serviceType = Context.TELEPHONY_SERVICE;
    TelephonyManager m_telephonyManager = (TelephonyManager) getActivity().getSystemService(serviceType);
    String DeviceId, SubscriberId, NetworkOperator, OsVersion,SimOperatorName;
    DeviceId = m_telephonyManager.getDeviceId();
    SubscriberId = m_telephonyManager.getSubscriberId();
    NetworkOperator = m_telephonyManager.getNetworkOperator();
    OsVersion = m_telephonyManager.getDeviceSoftwareVersion();
    SimOperatorName = m_telephonyManager.getSimOperatorName();
    

    Show Output

    Log.d("Device Information :", "\n DeviceId : " + DeviceId +
                                "\n SubscriberId : " + SubscriberId
                                + "\n NetworkOperator : " + NetworkOperator +
                                "\n SoftwareVersion : " + OsVersion+
                                "\n SimOperatorName : " + SimOperatorName);
    

提交回复
热议问题