Bluetooth scanning process

For the scanning process, following objects should be prepared in order:

BluetoothManager mBluetoothManager =         (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE); BluetoothAdapter mBluetoothAdapter = mBluetoothManager.getAdapter();

getSystemService() method brings back the Bluetooth Service Manager, if called with Context.BLUETOOTH_SERVICE. This manager can then be used to get the adapter which is the core of the Bluetooth operation. As mentioned in the code, mBluetoothAdapter can be acquired by calling getAdapter() on the BluetoothManager object. This bluetooth adapter will now be used to get the BluetoothLeScanner object:

mBluetoothLeScanner = mBluetoothAdapter.getBluetoothLeScanner();

It is a good ...

Get Building Bluetooth Low Energy Systems now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.