@Override protected void onStop() { SensorHandler.unregisterListener(this); ServiceProvider.getService(CatroidService.BLUETOOTH_DEVICE_SERVICE).pause(); FaceDetectionHandler.stopFaceDetection(); super.onStop(); }
public void setFormula(Formula formula) { formulaToCompute = formula; if (formula.containsElement(ElementType.SENSOR)) { SensorHandler.startSensorListener(context); SensorHandler.registerListener(this); } int resources = formula.getRequiredResources(); if ((resources & Brick.FACE_DETECTION) > 0) { FaceDetectionHandler.startFaceDetection(getContext()); } if ((resources & Brick.BLUETOOTH_LEGO_NXT) > 0) { BluetoothDeviceService btService = ServiceProvider.getService(CatroidService.BLUETOOTH_DEVICE_SERVICE); btService.connectDevice(BluetoothDevice.LEGO_NXT, this.getContext()); } }