in src/android/AccelListener.java [142:177]
private int start() {
// If already starting or running, then restart timeout and return
if ((this.status == AccelListener.RUNNING) || (this.status == AccelListener.STARTING)) {
startTimeout();
return this.status;
}
this.setStatus(AccelListener.STARTING);
// Get accelerometer from sensor manager
List<Sensor> list = this.sensorManager.getSensorList(Sensor.TYPE_ACCELEROMETER);
// If found, then register as listener
if ((list != null) && (list.size() > 0)) {
this.mSensor = list.get(0);
if (this.sensorManager.registerListener(this, this.mSensor, SensorManager.SENSOR_DELAY_UI)) {
this.setStatus(AccelListener.STARTING);
// CB-11531: Mark accuracy as 'reliable' - this is complementary to
// setting it to 'unreliable' 'stop' method
this.accuracy = SensorManager.SENSOR_STATUS_ACCURACY_MEDIUM;
} else {
this.setStatus(AccelListener.ERROR_FAILED_TO_START);
this.fail(AccelListener.ERROR_FAILED_TO_START, "Device sensor returned an error.");
return this.status;
};
} else {
this.setStatus(AccelListener.ERROR_FAILED_TO_START);
this.fail(AccelListener.ERROR_FAILED_TO_START, "No sensors found to register accelerometer listening to.");
return this.status;
}
startTimeout();
return this.status;
}