none
BluetoothLEAdvertisementWatcher doesn't work RRS feed

  • Question

  • I'm using Windows 10 Version 1703(OS Build 15063.1029)

    When I go to Settings -> Devices -> Bluetooth and switch on Bluetooth, I can see nearby BLE devices (they are custom made BLE devices).

    I want to discover these BLE devices using UWP application. I use the following code snippet to start the BluetoothLEAdvertisementWatcher.

                   deviceWatcher = new BluetoothLEAdvertisementWatcher();
                    deviceWatcher.ScanningMode = Windows.Devices.Bluetooth.Advertisement.BluetoothLEScanningMode.Active;
                    deviceWatcher.SignalStrengthFilter.InRangeThresholdInDBm = -80;
                    deviceWatcher.SignalStrengthFilter.OutOfRangeThresholdInDBm = -90;
                    deviceWatcher.Received += OnAdvertisementReceived;
                    deviceWatcher.SignalStrengthFilter.OutOfRangeTimeout = TimeSpan.FromMilliseconds(5000);
                    deviceWatcher.SignalStrengthFilter.SamplingInterval = TimeSpan.FromMilliseconds(2000);
                    deviceWatcher.Start();

       private async void OnAdvertisementReceived(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementReceivedEventArgs eventArgs)
            {

    //getting only devices i need

           }

    But the callback to OnAdvertisementReceived is not received.

    If i Switch off the bluetooth and switch it ON , then i start receiving callbacks.

    I even checked Bluetooth checkbox in Capabilities tab in Package.appxmanifest.

    Can anyone tell what might be the issue?


    • Edited by AnkitaK Wednesday, May 2, 2018 7:19 AM
    Wednesday, May 2, 2018 7:18 AM

All replies

  • Try to use to a more recent version. At least 1709. They did quite a lot of changes in BLE recently.

    -- pa

    Wednesday, May 2, 2018 4:18 PM
  • Thank you Pavel.

    But I need it to work in Version 1703.

    It'll be really helpful if you can suggest something in making that work in 1703 version.

    Update: I checked in the Event logs to see if something might turn up and " A command sent to the adapter has timed out. The adapter did not respond. " warning is displayed with Source as BTHUSB whenever Scanning had stopped.



    • Edited by AnkitaK Thursday, May 10, 2018 5:48 AM
    Friday, May 4, 2018 8:45 AM
  • 我用1803的版本也不行
    Thursday, December 13, 2018 5:52 AM