tinku tinku - 1 year ago 129
Android Question

Is there any Android api to find/sense room temperature programmatically in android code?

I am developing an android app for my project, I need to find room temperature as part of it. I am using Droid 2 A955 model for testing.

My Questions are:

  1. What sensors need to be available in my Android phone to perform
    this temperature sensing task?

  2. Can Ambient Light Sensor (available in Droid 2) help in doing this

  3. Is there any Android api to find/sense room temperature
    programmatically in my android code?

Thanks in advance for your help.

Answer Source

To answer all three of your questions in one fell swoop, no, I don't believe so. There can be a temperature sensor in android devices, but it senses the temperature of the battery, not the outside temperature. It would not provide an accurate gauge for that purpose.

I'm not sure how an ambient light sensor would help with temperature, it can be very bright out but it could be in an air conditioned room.

Lastly: there are lots of examples of temperature apps, but again, most are related to the battery.

Edit: Official documentation says:

Device implementations MAY but SHOULD NOT include a thermometer (i.e. temperature sensor.) If a device implementation does include a thermometer, it MUST measure the temperature of the device CPU. It MUST NOT measure any other temperature. (Note that this sensor type is deprecated in the Android 2.3 APIs.)


API level 14 (i.e. Android 4.0) onwards, support for measuring ambient temperature has been added (via TYPE_AMBIENT_TEMPERATURE). [Android doc reference]

This, however, will work only on devices with ambient temperature sensor.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download