Bluetooth custom Pairing using a windows service

A.P 1 Reputation point
2020-09-29T10:12:24.843+00:00

Hi!
We're having a problem using custom pairing process, specifically when running as a windows service.
When running as an app, we are able to pair without problem. Running the same piece of code as a windows service however, returns a Failed DevicePairingResultStatus, even though the pairing pin code is correct and used exactly the same way as when running as an APP.
Pairing is performed with DeviceInformation.Pairing.Custom.PairAsync(DevicePairingKinds.ProvidePin, DevicePairingProtectionLevel.Encryption) method.

We've tried running the service as logged on as Local System, Local Service, local user with admin privileges, Administrator and Network Service with the same results.
Does anyone have any suggestions as to why the difference exists between running as a windows service and running as an app? And how to bypass this?
We use the Windows.Devices.Bluetooth namespace which defines a Windows Runtime API that allows UWP desktop apps to interact with Bluetooth devices.
The app was built under .net core 3.0, Windows 10 is updated as well as Bluetooth drivers etc.

Thanks!

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
37,797 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Roy Li - MSFT 32,731 Reputation points Microsoft Vendor
    2020-09-30T06:58:22.193+00:00

    Hello,

    Welcome to Microsoft Q&A!

    Your question is neither within the scope of UWP nor within the scope of windows service. Because you are not having the issue in a UWP project and it is not a normal windows service.

    Our suggestion is that do not run the Bluetooth tool as a windows service to avoid this unexpected behavior.

    Thank you.

    0 comments No comments