I don't understand how to use this method,
sensorManager.registerListener(SensorEventListener listener, Sensor sensor, int rate, Handler handler);
1) If it uses a SensorEventListener, then what's the purpose of the Handler?
2) Please give an example of a handler I could pass to it?
If it uses a SensorEventListener, then what's the purpose of the Handler?
If I had to guess, it is so you can get your sensor events delivered on a background thread (e.g., a
HandlerThread). By default, sensor events are delivered on the main application thread, which is fine in some cases.