locked
ControlChannelTrigger with a Hardware slot, not receiving response from server when app is in the background.

    General discussion

  • Hello,

    I've been following the guide to creating a Windows Store App with a BackgroundTask Network Trigger also looking at ControlChannelTrigger HttpClient sample.

    When I'm remotely debugging on my Dell Venue 8 Pro, it seems like my ControlChannelTrigger works correctly and I get the response from my web server delivered to my 

    OnSendRequestCompleted

    method as expected.

    However if I run the same code without the the debugger connected and put the app into the background, the responses don't get sent to my OnSendRequestCompleted method until the app is in the foreground.

    Its my understanding that if my ControlChannelTrigger has a hardware slot, that it should always get the response.

    I've been testing this with the HttpClient sample with only very minor changes, one being the web server, when it get a request it waits 45s before sending the response.

    The second change is that in the OnReadCompleted method, I reset the request and set up a new one.

             private void OnReadCompleted(IAsyncOperationWithProgress<IBuffer, uint> asyncInfo, AsyncStatus asyncStatus)

    {

    ...

    if (buffer.Length == 0) { // The response is complete lock (this) { ResetRequest(); SetupHttpRequestAndSendToHttpServer(); } return; }

    ...

    }

    Can anyone confirm that I'm understanding the purpose of ControlChannelTriggers correctly.

    Meant for running background tasks - Regardless of whether the app is suspended and/or in low power mode (assuming it has a hardware slot), it can receive network triggers. 

    Tuesday, March 18, 2014 2:59 PM