Sensor types:
1. Motion sensor
Acceleration sensors, gravity sensors, and gyroscope (mobile phone attitude judgment)
2. Position Sensor
Direction sensor and Magnetic Sensor
3. Environment Sensors
Temperature Sensor, pressure sensor, and brightness Sensor
Sensor usage:
1. Get the sensormanager object
Sensormanager = (sensormanager) getsystemservice (context. sensor_service );
2. Run the getdefasensensor () method of the sensormanager object to obtain the Sensor Object and pass in a specific parameter.
3. Get attributes of the Sensor Object
4. register the sensor using the sensormanager object, sensormanager. registerlistener (sensoreventlistener listener, sensor, int rate );
The third parameter is the acquisition frequency: sensor_delay_normal (200000 subtle) sensor_delay_ui (60000 subtle) sensor_delay_game (20000 subtle) sensor_delay_fastest (0 microsecond) usage principle: Try to use a lower sensor sampling rate. In this way, the system consumes less and saves power.