3
votes

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.

2
This also stopped working for me for Creators Update on my build machine (not even targeted SDK, yet). Is your current targeted SDK Creators Update? Then, when I change the SDK to Creators Update (so SDK and build machine are both Creators Update), I get a capabilities error on Register(), despite my manifest info working for Anniversary Update. - Tyress
@Tyress my app targets the anniversary update, so there is no change other than installing the creators update on the dev box. No error is thrown, the app just hangs when bldr.Register() is called. - Markus
@Markus Did you resolve this problem? - Stanislav Mayorov
@StanislavMayorov unfortunately not. I haven't been able to track this down. - Markus

2 Answers

1
votes

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.

1
votes

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.