Essential Android Bluetooth Low Energy (LE) edit forum

Finding BLE Devices

The following permissions are required to use the Bluetooth APIs:

android.permission.BLUETOOTH
android.permission.BLUETOOTH_ADMIN

If you’re targeting devices with Android 6.0 (API Level 23) or higher and want to perform scanning/advertising operations you will require a Location permission:

android.permission.ACCESS_FINE_LOCATION

or

android.permission.ACCESS_COARSE_LOCATION

Note.- Devices with Android 6.0 (API Level 23) or higher also need to have Location Services enabled.

A BluetoothAdapter object is required to start scanning/advertising operations:

BluetoothManager bluetoothManager = (BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE);
bluetoothAdapter = bluetoothManager.getAdapter();

The startScan (ScanCallback callback)method of the BluetoothLeScanner class is the most basic way to start a scanning operation. A ScanCallback object is required to receive results:

bluetoothAdapter.getBluetoothLeScanner().startScan(new ScanCallback() {
     @Override
     public void onScanResult(int callbackType, ScanResult result) {
     super.onScanResult(callbackType, result);
     Log.i(TAG, "Remote device name: " + result.getDevice().getName());
       }
    });

Table Of Contents
39 ACRA
64 Menu
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
217 Paint
231 AIDL
241 JCodec
243 Okio
248 Bluetooth Low Energy (LE)
255 Looper
  ↑ ↓ to navigate     ↵ to select     Esc to close