Posts

Bluetooth Low Energy in Android.

Android provides built-in platform support for Bluetooth Low Energy (BLE) in the central role and provides APIs that apps can use to discover devices, query for services, and transmit information. Common use cases include the following: Transferring small amounts of data between nearby devices. Interacting with proximity sensors to give users a customized experience based on their current location. The following is a summary of key BLE terms and concepts:           Generic Attribute Profile (GATT)          Profiles Attribute Protocol (ATT) Characteristic Descriptor Service Find BLE devices private BluetoothLeScanner bluetoothLeScanner = bluetoothAdapter . getBluetoothLeScanner (); private boolean scanning ; private Handler handler = new Handler (); // Stops scanning after 10 seconds. private static final long SCAN_PERIOD = 10000 ; private void scanLeDevice () {     if (! scanning ) {         // Stops scanning after a predefined scan period.         handler . postDela