Forum Xamarin.Android

Bluetooth scanning for LE devices, uuid is null

I develop an app, that should connect with LE beacons and get data from them (Eddystone and iBeacon). The app should connect with a device in background, without user interaction. So I need to know, which devices that my phone found is the right one. This can be achieved by getting UUID of found device. And here is my problem.

If I use StartScan method of BluetoothLeScanner class, I get only LE devices and can get UUID (even if not after first discovery) of every one of them. Unfortunately this requires Location permission (which I don't mind) and on some phones GPS must be on (and that I don't want).

But if I use StartDiscovery method from BluetoothAdapter class, I get all devices, which I can sort by Type property, and GPS is not necessary. But I cannot get UUID this way. After discovering it's null, after calling FetchUuidsWithSdp method and waiting for result it is still null. For a moment, when I had only two devices around, and they were all Classic type (laptop and other phone), I could get UUID. But I can't repeat that and I don't know what can cause that.

Sign In or Register to comment.