Now I'm trying to run
HardwarePropertiesManager hardwarePropertiesManager = getApplicationContext().getSystemService(HardwarePropertiesManager.class);
hardwarePropertiesManager.getDeviceTemperatures(HardwarePropertiesManager.DEVICE_TEMPERATURE_CPU, HardwarePropertiesManager.TEMPERATURE_CURRENT);
to check cpu usage and temperature..
but, the exception occurred, which is
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.example.___/com.example.___.MainActivity}:
java.lang.SecurityException: The caller is neither a device
owner, nor holding the DEVICE_POWER permission, nor the current
VrListener.
is there any method to check cpu temperature and cpu usage(memory, core)??
As the documentation mentions HardwarePropertiesManager is available for applications which are device owners - https://developer.android.com/reference/android/os/HardwarePropertiesManager
You can try reading the data from file
There are some changes based on vendors. You can refer to https://stackoverflow.com/a/59306562 for comprehensive list.