in rx-central-ble-sample/src/main/java/com/uber/rxcentralble/sample/MainActivity.java [199:217]
public void bleDetect(CompoundButton button, boolean checked) {
if (checked && bluetoothDetection == null) {
Timber.i("Bluetooth Detection Active");
bluetoothDetection = new CompositeDisposable();
bluetoothDetection = bluetoothDetector
.enabled()
.subscribe(enabled -> {
if (enabled) {
Timber.i("Bluetooth Enabled");
} else {
Timber.i("Bluetooth Disabled");
}
});
} else if (bluetoothDetection != null) {
bluetoothDetection.dispose();
bluetoothDetection = null;
Timber.i("Bluetooth Detection Deactivated");
}
}