Q: Android: one sensor, more sensor evnt listeners I know that in Android it is possible to register the same sensor event listener on different sensors, but my question is: is it possible to register more than one sensor event listener on the same sensor? Thanks
 SensorDataLogger sensorDataLogger = new SensorDataLogger();
    GaitRecognition gaitRecognition = new GaitRecognition();

    sensorManager.registerListener(sensorDataLogger, sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_GAME);
    sensorManager.registerListener(gaitRecognition, sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_NORMAL);

    new Thread(sensorDataLogger).start();
    new Thread(gaitRecognition).start();

SensorDataLogger and GaitRecognition both implement Runnable and SensorEventListener.
This is the SensorDataLogger class:
public class SensorDataLogger implements Runnable, SensorEventListener {

long lastUpdate ;
long count = 0;


File directory, file;

public SensorDataLogger() {

    directory = Utilities.createDirectory("PROVE_CAMPIONI");
    file = Utilities.createFile(directory, "file_logger.txt");
}

@Override
public void run() {

}

@Override
public void onSensorChanged(SensorEvent event) {

  //  Log.d("SensorDataLogger","Sample acquired  "+event.values[0]);
   long sampleTime = System.currentTimeMillis();
    getData(event, sampleTime);
}

@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {

}


public void getData(SensorEvent event, long sampleTime) {
    float[] values = event.values;

    if(lastUpdate == 0) {
        lastUpdate = sampleTime;
    }
    long diff = sampleTime - lastUpdate;
    count+=diff;
    lastUpdate = sampleTime;

    // Log.e("Sensor data logger","Sample acquired at "+timeStamp+" " +event.values[0]);
    Utilities.writeData(file, Utilities.getTimeInSeconds(count) +", "+values[0]+", "+values[1]+", "+values[2]+"\n");



}

}

A: Check out sensor work if you provide some code examples. I can help you with the code needed to achieve that. If you already know how to register an event listener just do the same for all the listeners.
https://play.google.com/store/apps/details?id=com.splendapp.donottouchmyphone

A: Yes, it keeps a list of listeners and once an event is generated, all the listeners on the list are notified.
If you provide some code examples I can help you with the code needed to achieve that, but if you already know how to register an event listener just do the same for all the listeners.
