问题
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