Jakob
Jakob

Reputation: 170

Android: Seperate Bluetooth Classic Scan from Low Energy Scan, or distinguish Classic Devices from Low Energy Devices

I'm developing an android app, that implements Bluetooth. Bluetooth Scan and everything runs fine (i refered to the android bletooth chat code example here:(https://android.googlesource.com/platform/development/+/25b6aed7b2e01ce7bdc0dfa1a79eaf009ad178fe/samples/BluetoothChat ), but when the bluetooth scan runs, my device finds also Bluetooth Low Energy devices. I've tried it with a Galaxy Nexus (Android KitKat) and with a Nexus 7 (2013) (also KitKat).

How can I prevent the BluetoothAdapter from discovering Bluetooth LE Devices, when using the function

mBluetoothAdapter.startDiscovery();

The official Bluetooth Low Energy example (http://developer.android.com/samples/BluetoothLeGatt/index.html) says that for an Low energy scan you have to use

mBluetoothAdapter.startLEScan();

As an workaround is it possible to distinguish a discovered Bluetooth Classic Device from a discovered Bluetooth Low Energy Device?

Upvotes: 3

Views: 1832

Answers (1)

Mr. Jones
Mr. Jones

Reputation: 405

You can use the function

getType()

for each

BluetoothDevice

see: http://developer.android.com/reference/android/bluetooth/BluetoothDevice.html

and search for all devices which are DEVICE_TYPE_CLASSIC

Upvotes: 3

Related Questions