none
[UWP][C#]Background task is not invoked during modern standby RRS feed

  • Question

  • I have written a C# UWP app for win10 which basically creates a listener socket and transfers the ownership to the background task. As soon as a client connects, the background task would reply with some data to client and would invoke a toast notification. This app works fine when system is awake(S0) but when in sleep (i.e. modern standby case S0i3), I could only see TCP connection is successful in Wireshark logs(because of WoWLAN) but I don't see data being transmitted by background task. Few questions in the same line:

    1. My expectation from modern standby system: because of WoWLAN system wakes up and calls my background task to handle “SocketActivityTriggerReason.ConnectionAccepted” event and whatever data I’m transmitting in this handler is sent to the client and system goes back to sleep. But in my case only TCP connection(SYN->ACK) is successful and looks like background task is not invoked. What is the procedure to get it working ?
    1. Assuming question 1 is resolved and works, Is there any way I can turn on the display from background task on receiving SocketActivityTriggerReason.ConnectionAccepted in modern standby case and notify the user?

    • Edited by Barry Wang Thursday, March 28, 2019 2:38 AM title tag
    Wednesday, March 27, 2019 5:30 AM

All replies

  • Hello AjNyk,

    I think the following doc should be read first and here it is: Modern Standby wake sources

    1. For the first question. My understanding is that backgrountask cannot work on sleep mode. And only notification would work

    2. For display, you may need to check the table Wakes SoC but cannot turn on display, there are many conditions first.

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, March 28, 2019 5:52 AM
  • Hi Barry,

    I have already gone through that doc. Also from documentation on "network-communications-in-the-background", looks like a system should wake up on network activity during modern standby and give the data to background task, no? 

    I'm actually looking for a http server implementation which should respond even when system is in modern standby. Is there any sample app for the same ?

    Thanks,

    Ajith

    Thursday, March 28, 2019 9:32 AM
  • @Ajith,

    Can you be specific about the devices that your client side is using. Suppose your device is a surface, we want to know whether you are on ARM or on X64/X86. This should make the issue more clear.

    By the way, actually the sample you request may not be exist. 

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, April 15, 2019 7:45 AM
  • @Ajith,

    Actually we have done some tests and here is our result:

    The doc mentioned:

    Modern standby within UWP only works with SoC. “ Universal Windows Platform (UWP)  Applications UWP applications can wake the SoC from the deepest idle state to sync and display notifications, depending on a device's power source, notification priority levels, and app-specific user configurations “. (Please refer to : https://docs.microsoft.com/en-us/windows-hardware/design/device-experiences/modern-standby-wake-sources#wakes-soc-but-cannot-turn-on-displayhttps://docs.microsoft.com/en-us/windows-hardware/design/device-experiences/modern-standby-wake-sources#wakes-soc-but-cannot-turn-on-display)

    Windows 10 can only connect to the network when in sleep mode when installed on Tablets or Mobile phones. There is a system settings related to the function on Windows 10 tablets:

    When testing we can find that SocketActivity works if we enable this system setting. So for your question 1, please check whether your setting first.

    For your question 2, as the doc already mentioned, we cannot wake the display.

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, April 19, 2019 9:23 AM
  • Hi Barry,

    Thank you for your reply and sorry for my late reply. When you say "Windows 10 can only connect to the network when in sleep mode" Do you mean only connect is possible and data exchange b/w application is not possible when in  S0i3?

    Just to add I have confirmed these settings and even skype call could wake up wake up the system. Unfortunately my app didn't receive the data over socket when in S0i3.

    Thanks,

    Ajith


    • Edited by AjNyk Monday, June 24, 2019 7:52 AM Adding few additional details
    Monday, June 24, 2019 7:10 AM