Background task registration hangs in UWP with GattCharacteristicNotificationTrigger

馋奶兔 提交于 2019-12-05 02:19:15

问题


I'm trying to use an in-process background task to get notifications of a Bluetooth LE device. However, the following code hangs at the last line and does not return:

var bldr = new BackgroundTaskBuilder();
bldr.Name = guid.ToString("N");
var trigger = new GattCharacteristicNotificationTrigger(ch);
bldr.SetTrigger(trigger);
bldr.Register();

Getting the notifications of the device works when using the event-based model in the application. Also, registering the task with a TimeTrigger works, so the declaration in the app manifest is ok.

The computer runs the Creators Update, but the UWP is set to require the Anniversary update as a minimum.


回答1:


We've had the same issue with UWP app on windows 10 mobile. It was resolved after we had updated windows 10 mobile to build 10.0.15230.0.




回答2:


This hang on Register issue for GattCharacteristicNotificationTrigger was identified and fixed thanks to this question. The fix was released in build 15228 as a servicing build to the Creator's Update of the OS.



来源:https://stackoverflow.com/questions/43487748/background-task-registration-hangs-in-uwp-with-gattcharacteristicnotificationtri

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!