Sensor Exmaple in Android(Accelerometer and Proximitry Sensor)

This is an example that will show how to use sensors in android. This example includes two sensors: 1) Accelerometer Sensor 2) Proximity Sensor This is an example that will show you how can you move any object(ex:- Textview) in android using an accelerometer sensor. And also use proximity sensors to generate toast. You can do anything with this sensor that you want for your application. Steps:- 1) First you need to implement SensorEventListener and overrides its method. 2) Create Object of SensorManager class. 3) Register all sensor listeners with the sensor manager object. 4) The unregistered sensor when activity destroyed or pause. Note:- Don't forget to unregistered your sensor once you are done with the sensor. Note:- In proximity sensor values are different as per the mobile company. In this example, I am using moto g (1st gen) the value of the proximity sensor are 3.0 for near and 100.0 for far. For most of the other devices, values are 0 for near and 1 f...