创建者更新后无法注册GattCharacteristicNotificationTrigger后台任务

Tyr*_*ess 14 c# bluetooth win-universal-app .net-core

后台任务注册代码如下所示:

var builder = new BackgroundTaskBuilder();
builder.Name = name;
builder.TaskEntryPoint = typeof(BackgroundTaskClass).FullName;
var trigger = new GattCharacteristicNotificationTrigger(characteristic);
builder.SetTrigger(trigger);
btr = builder.Register();
Run Code Online (Sandbox Code Playgroud)

清单中的条目是:

<Extension Category="windows.backgroundTasks" EntryPoint="BackgroundTaskNS.BackgroundTaskClass">
  <BackgroundTasks>
    <Task Type="deviceConnectionChange" />
    <Task Type="bluetooth" />
  </BackgroundTasks>
</Extension>
Run Code Online (Sandbox Code Playgroud)

Register()方法触发此错误:

访问被拒绝.

您的应用程序无权在后台使用Gatt服务.确保您已在清单中声明了DeviceCapability和任务类型"bluetooth",并且该应用程序已被授予对此设备的访问权限.

这仅发生在构建计算机上安装的Creators Update上,并且还针对Creators Update SDK.在我们更新SDK和构建机器之前,这很有效.

Sta*_*rov 4

我们在 Windows 10 移动版上使用 UWP 应用程序时遇到了同样的问题。

我们将 Windows 10 Mobile 更新为版本 10.0.15230.0,然后删除该应用程序(在手机上手动)并再次安装。现在效果很好。我们还安装了最新版本的SDK,但我认为这一步可以跳过。