locked
How can I keep the backgroundtask running without being terminated? RRS feed

  • Question

  • My App registers a backgroundtask with SystemTrigger (UserPresent), and it works well.

    I want to keep the backgroundtask running while the user is not logoff.

    But I found that there are many reasons which can stop the backgroundtask:

    1. When the I closed the App by the gesture( drag from the screen top to the bottom), the backgroundtask's onCanceled method is triggered.

    2.When entered the QuietHours.

    3.unknown situation, the BackgroundTaskCancellationReason is Terminating.

    How can I stop the backgroundtask being canceled except Uninstalled\Unregistered\Conditionloss?

    Friday, November 15, 2013 6:42 AM

Answers

  • Hi whl_tingyu,

    SystemTrigger should works fine because it executes in the system-provided BackgroundTaskHost.exe, it is launched independently of the state of the app, and should not be affected by user action such as closing gesture. We need to know if your background task executes in the system host or executes within the app process, if in the app process the background task infrastructure might need to change the state of the app. Maybe you could provide us some code for testing? Read this for more information:http://social.msdn.microsoft.com/Forums/windowsapps/en-US/09a9d3c2-2277-4ab0-9b56-1b6accf6c411/which-process-host-my-background-task?forum=winappswithnativecode

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Monday, November 18, 2013 11:23 AM
    Moderator