I try to scan BLE devices in my Windows 10 IOT background (headless) app running on Raspberry PI 3.
I also tried to use BluetoothLEAdvertisementWatcher in a headed app (with UI) on the same RaspBerry PI machine and it worked.
My headless app is the simplest as it can be:
public sealed class StartupTask : IBackgroundTask
{
private readonly BluetoothLEAdvertisementWatcher _bleWatcher =
new BluetoothLEAdvertisementWatcher();
public void Run(IBackgroundTaskInstance taskInstance)
{
_bleWatcher.Received += _bleWatcher_Received;
_bleWatcher.ScanningMode = BluetoothLEScanningMode.Active;
_bleWatcher.Start();
}
private void _bleWatcher_Received(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementReceivedEventArgs args)
{
}
}
_bleWatcher_Received is never hit. Capabilities are set (Bluetooth, Internet, Proximity).
What is the problem? What do I miss?