Class representing a sensor. Use getSensorList(int) to get the list of available Sensors.
1. Set the Minimum and Target SDK version to 3, or greater.
import android.hardware.Sensor;
3. Add the below line to the onCreate method. This will declare a Sensor object named mySensor.
Sensor mySensor;
4. Compile and run