如何将CPU使用率和温度信息获取到Android应用程序中? [英] How I get CPU usage and temperature information into an android app?

查看:36
本文介绍了如何将CPU使用率和温度信息获取到Android应用程序中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发应用程序,但我不知道如何获得CPU使用率和温度,例如在textview中.我尝试使用 TYPE_AMBIENT_TEMPERATURE 来获取温度,但是它不起作用.日志显示我没有传感器",但是通过使用Play商店中的其他应用程序,我可以获得温度和频率.

I'm developing an application and I don't know how can I get CPU usage and temperature, example in a textview. I try with TYPE_AMBIENT_TEMPERATURE to get temperature, but it doesn't work. Logs say that "i haven't the sensor", but by using other apps in the play store I get the temperature and freq..

如果我使用其他传感器(例如 TYPE_GYROSCOPE 或其他传感器),则该代码可以正常工作,因此我不理解 TYPE_AMBIENT_TEMPERATURE 是如何工作的..

The code works fine if I use other sensor like TYPE_GYROSCOPE or other, so I don't understand how TYPE_AMBIENT_TEMPERATURE doesn't work..

对不起,我的英语不好...,请帮助我.

Sorry for my bad english...and please help me..

推荐答案

这是因为您的设备根本没有温度计.许多较旧的设备都没有它.Android文档说,"MAY"设备内置了这些传感器,但并不需要它们".

this is because your device simply doesn't have the thermometer. A lot of older devices don't have it. Android documentation says devices "MAY" have these sensors built in, but are not "required" to have them.

其他显示温度的应用程序是通过自己的方法进行计算的(在某些程度上可能有所不同)

the other apps that are showing you the temperature, are calculating by their own methods (which may all be different to certain extents)

我目前正在开发自己的应用程序,以自己测量CPU温度...

I am currently in the process of making my own app that measures CPU temperatures myself...

这篇关于如何将CPU使用率和温度信息获取到Android应用程序中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆