Android 如何访问 Galaxy S5 温度传感器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23502229/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to access Galaxy S5 temperature sensor?
提问by sandalone
In the manualon the page 19 there is an info on temperature sensor in S5.
在第 19 页的手册中,有关于 S5 中温度传感器的信息。
Temperature and Humidity sensor allows your device to read both temperature and humidity conditions. This is useful to calculate calories burned within S Health
温度和湿度传感器允许您的设备读取温度和湿度条件。这对于计算 S Health 中燃烧的卡路里很有用
But I cannot seem to find any data on how to use this sensor.
但我似乎找不到有关如何使用此传感器的任何数据。
Did anyone find any way to use this sensor in our own app?
有没有人找到在我们自己的应用程序中使用这个传感器的方法?
EDIT
编辑
Take note that if you install any 3rd party temperature application, it will say that your device (S5) does not have temperature sensor. So I cannot use the standard code to access the sensor because sensor is not being detected. But Samsung app S Health is using this sensor and I am not sure which API it uses.
请注意,如果您安装任何 3rd 方温度应用程序,它会说您的设备 (S5)没有温度传感器。所以我不能使用标准代码来访问传感器,因为没有检测到传感器。但是三星应用程序 S Health 正在使用这个传感器,我不确定它使用的是哪个 API。
采纳答案by sandalone
Galaxy S5 does not have Temperature and Humidity sensors, unlike S4. Samsung announced it and close to publishing decided not to ship it. It seems that the reason was the fact that these two sensors could not work along with water-proof feature.
与 S4 不同,Galaxy S5 没有温度和湿度传感器。三星宣布并接近出版决定不发货。原因似乎是这两个传感器无法与防水功能一起使用。
S Health app has ability to measure body temperature but its API is hidden at this moment. It means that we have no clue if it measures temperature via external devices (Gear) or it can measure it using heart-rate sensor. Also we don't know if it can measure air temperature (probably not).
S Health 应用程序具有测量体温的功能,但此时其 API 是隐藏的。这意味着我们不知道它是通过外部设备(Gear)测量温度还是使用心率传感器测量温度。我们也不知道它是否可以测量气温(可能不能)。
回答by user3573421
http://developer.android.com/reference/android/hardware/Sensor.html#TYPE_AMBIENT_TEMPERATURE
http://developer.android.com/reference/android/hardware/Sensor.html#TYPE_AMBIENT_TEMPERATURE
I think this is what you're looking for
我想这就是你要找的