I wonder if it is possible to discover unpaired Bluetooth devices programmatically within a Windows 10 tablet application.
I really don't want to pair by Settings -> Devices -> Bluetooth.
Unfortunately I couldn't find any documentation/example that would have helped.
I tried to search for Bluetooth devices by using the BluetoothLEAdvertisementWatcher but I wasn't able to find any. Probably because these devices were no BluetoothLE devices. Thought these were compatible.
Also I thought it would be possible to create a CLI/C++ wrapper that I could reuse in my UWP application but I feel very uncertain about that as not the whole (especially the interfacing part of the) Win32 API is re-usable in UWP environment.
At a last option I thought there must be a way to just get the list of devices that Windows generates when entering Settings -> Devices -> Bluetooth and I tried to achieve that by using a DeviceWachter but without success.
Now I am very desperate. For my application it would be horrible to manually pair each and every device before using it. I cannot understand why Microsoft cuts the developers so enormous.
Thanks in advance for your help.
Grace's answer is correct. I tried this sample before but stopped working on it as it expected a Windows Phone instead of a Windows 10 tablet.
Now I extracted the DeviceWatcher part but created the DeviceWatcher with the selector BluetoothDevice.GetDeviceSelectorFromPairingState(false). Only with this selecter the watcher was able to finde unpaired Bluetooth devices.
It also works with:
DeviceInformation.FindAllAsync(BluetoothDevice.GetDeviceSelectorFromPairingState(false))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With