April 2017
Intermediate to advanced
242 pages
6h 10m
English
This class was added in Android API Level 18 and it enables the basic Bluetooth Smart communication. Functionalities like service discovery and reading/writing on characteristics are achieved using this class. In order to use this class, you first need to get the BluetoothGatt object by calling connectGatt() method on the scanned device.
BluetoothGatt mBluetoothGatt = device.connectGatt(this, true, mBluetoothGattCallback);
This mBluetoothGatt object can now be used to start service discovery process and read/write the characteristics. In order to connect to the device, you need to describe a BluetoothGattCallback class which will ask you to override methods to do tasks when a certain event triggers. We will discuss this class ...
Read now
Unlock full access