Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否有任何粘性数据可以获取 Sensor.TYPE_LIGHT 值。我不想一直监控事件变化,但在某些情况下,我希望让光传感器的值做出相应的反应。
为我需要的东西注册和运行 24x7 的传感器似乎根本不是一个好主意。
不,不注册监听器就不可能只获取传感器的当前值。但是您可以注册一个侦听器,侦听一个或多个更改(并获取平均值),然后再次取消注册该侦听器。