How can I get sensor data in Android?

How can I get sensor data in Android?
Answer
Use the sensor property of the SensorEvent to get a Sensor object, and then use getType() to get the type of that sensor. Sensor types are defined as constants in the Sensor class, for example, Sensor. TYPE_LIGHT . Also in onSensorChanged() , get the sensor value.
 

Tìm kiếm

Back
Top