How to tell if Android startDiscovery() discovers BLE or Classic device

659 Views Asked by At

When using Android's startDiscovery() method to discover Bluetooth devices one gets BOTH classic and Bluetooth Low Energy devices in the BroadcastReceiver action DEVICE_FOUND. The problem is that I cannot find a way to tell if the discovery came from a BTLE scan or a classic inquiry.

In many cases I can use the device type, but that doesn't work if the device is dual.

If it is dual, then in many cases I can look at the Device class. If the device class is not 7936 (unspecified), then I know it is a classic device. However, some classic devices are too lazy to put in a class value so it is reported as unspecified.

So now I am up against devices that are dual, responds to both inquiries and BTLE scans, and in the classic inquiry give unspecified. So I do not know if the action DEVICE_FOUND is from a BTLE device or a classic device. That means I cannot connect to the correct handler. If its an inquiry response and I try and connect BTLE, that will fail and vice versa.

The best solution in my opinion would be that Android allows one to specify that startDiscovery ONLY does inquiries (or BTLE scans) and not both.

In the absence of that, does anyone know how I could tell whether the discovery was from an inquiry or a BTLE advertisement WITHOUT trying to connect?

0

There are 0 best solutions below