in rx-central-ble-sample/src/main/java/com/uber/rxcentralble/sample/MainActivity.java [64:97]
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
bluetoothDetector = ((SampleApplication) getApplication()).getBluetoothDetector();
connectionManager = ((SampleApplication) getApplication()).getConnectionManager();
peripheralManager = ((SampleApplication) getApplication()).getPeripheralManager();
scanner = ((SampleApplication) getApplication()).getScanner();
Timber.plant(new TextViewLoggingTree(logTextView));
if (BuildConfig.DEBUG) {
Timber.plant(new Timber.DebugTree());
Disposable d = RxCentralLogger
.logs(RxCentralLogger.LogLevel.DEBUG)
.subscribe(message -> Timber.d(message));
}
String[] perms = {
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.BLUETOOTH_CONNECT,
Manifest.permission.BLUETOOTH_SCAN
};
if (!EasyPermissions.hasPermissions(this, perms)) {
EasyPermissions.requestPermissions(this, "Permissions", 99, perms);
}
logTextView.setMovementMethod(new ScrollingMovementMethod());
}