32feet icon indicating copy to clipboard operation
32feet copied to clipboard

Way to bypass Windows 10 pair device permission?

Open hasham7861 opened this issue 2 years ago • 2 comments

Context: I'm working on a Windows 10 app that will allow users to quickly connect to a Bluetooth device. Because the native API is difficult to work with, I'm using the 'In The Hand' library. Anyway, back to the point: whenever I make a connect request. Before allowing me to connect, I receive this Pair a device notification.

I'm wondering if I can set Windows to automatically accept this permission for connecting the device. Is there a method in the Windows API that I can use to accomplish this?

Link to my code: https://github.com/hasham7861/bluetooth-le-experiment/blob/master/Program.cs

PairDevice_Capture

hasham7861 avatar Aug 07 '22 21:08 hasham7861

BluetoothSecurity.PairRequest can automate the pairing process with a known PIN or numerical value.

peterfoot avatar Aug 09 '22 11:08 peterfoot

Thank you @peterfoot one question though in the windows bluetooth settings, it says my headphones are connected but the device itself does not receive any notification that it is connected already. Is there a helper to communicate to signal the device that it is now connected.

My code is now this:

// pair of the device
BluetoothSecurity.PairRequest(device.deviceAddress, inputPin);
// categorize into audio section for windows
device.setServiceState(BluetoothService.Handsfree,true);

hasham7861 avatar Aug 11 '22 19:08 hasham7861