-
Notifications
You must be signed in to change notification settings - Fork 95
Getting started
Ivan Baranov edited this page Apr 24, 2017
·
8 revisions
-
Download.
compile 'com.github.ivbaranov:rxbluetooth:0.1.6'
Snapshots of the development version are available in Sonatype's snapshots
repository.
-
Declare permissions:
<uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
-
Create
RxBluetooth
instance. -
Check if bluetooth is currently enabled and ready for use.
if (!rxBluetooth.isBluetoothAvailable()) { // to enable blutooth via startActivityForResult() rxBluetooth.enableBluetooth(this, REQUEST_ENABLE_BT); }
-
Have fun.
-
Make sure you are unsubscribing and stopping discovery
OnDestroy()
.if (rxBluetooth != null) { rxBluetooth.cancelDiscovery(); } unsubscribe(rxBluetoothSubscription);