Creating a temperature-sensing Android app that runs in the background after activation

早过忘川 提交于 2019-12-25 04:16:31

问题


I am developing an Android application that will keep track of the temperature of the battery of the phone. When the temperature of the battery exceeds some certain value, another activity will then give an alert which is an alarm.

How can I let my application keep track of the temperature of the battery and send that info to another activity (an alarm system) to compare values and determine whether to set off the alarm?

I am using Eclipse and Android 4.1.2.


回答1:


There's a sensor. For Android:

http://developer.android.com/reference/android/os/BatteryManager.html#EXTRA_TEMPERATURE

Also relevant: Android Hardware Battery temperature, where is the sensor?



来源:https://stackoverflow.com/questions/12075084/creating-a-temperature-sensing-android-app-that-runs-in-the-background-after-act

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!