locked
Can we register and run a background task (with ApplicationTrigger) from Push notifications task RRS feed

  • Question

  • Hi

    I have two background tasks. My app is suspended and not on the screen; it runs only once, I register my first background task (TimeTrigger based) and then restart my phone to make sure my app is completely suspended. I don’t run the app again.

    1. First Background task triggered by TimeTrigger (15 minutes intervals)
    2. Second background task triggered by DeviceUseTrigger

    Now, when after 15 minutes interval, my first background task starts and try to register my second background task at that time I get "The system has denied the background task request".

    So I got this impression that DeviceUseTrigger background task cannot be registered and run from WITHIN any other background task, it always needs a UI thread. (Am I correct here? Please let me know).

    I have another question, can I use Push Notification to run the background task with DeviceUseTrigger?

    Can Push Notification act as UI thread to register and run DeviceUseTrigger and somehow I don’t get the error when I call await _deviceUseTrigger.RequestAsync(deviceId);

    Friday, October 7, 2016 2:04 PM