No more status property on the object passed to the function that handles the completion of a background task RRS feed

  • Question

  • Hello guys.

    In the previous release, we could check for the completion status of a background task by checking the status property of the object passed to the function that handles the completed event fired by the BackgroundTaskRegistration object.

    It seems like now we must pass this info through the local settings object. That being the case, do we still need to set the succeded property in the background task's worker?


    Luis Abreu

    Monday, June 18, 2012 12:41 PM

All replies

  • Yes, set the succeeded property to true!

    Jeff Sanders (MSFT)

    Tuesday, June 19, 2012 6:18 PM
  • Hello again.

    Here's my background task code:

    (function () {
        "use strict";
        var definicoes = Windows.Storage.ApplicationData.current.localSettings,
            tarefa = Windows.UI.WebUI.WebUIBackgroundTaskInstance.current,        
            url = "http://www.myweather2.com/developer/forecast.ashx?uac=dLKt3wmgwg&output=json&temp_unit=c&ws_unit=kph&query=32.6333333,16.9";

        tarefa.addEventListener("canceled", cancelou);
        function cancelou(sender, e) {        
            definicoes.values["resultado"] = "cancelado";
            tarefa.succeeded = false;
            url: url
        }).done(function (req) {
            var resposta = req.responseText;
            definicoes.values["funcionou"] = true;
            definicoes.values["resultado"] = resposta;
            tarefa.succeeded = true;
        function (req) {
            var erro = req.responseText;
            definicoes.values["funcionou"] = false;
            definicoes.values["resultado"] = erro;
            tarefa.succeeded = false;

    And here's my completion callback and what I get in the event object:

    And yes, I've changed the code, but in the previous release, it did work and state was indeed returned.

    Luis Abreu

    Tuesday, June 19, 2012 6:57 PM
  • I am sorry Luis, I don't understand what the question is.  I had thought I had answered it.  Can you tell me what the question is since I thought it was whether you should set completed to true but that is apparently not it?


    Jeff Sanders (MSFT)

    Tuesday, June 19, 2012 7:25 PM
  • You've answered the last question, but what about the first part: no more status property in the object passed to the function which handles the completed event?

    thanks again.

    Luis Abreu

    Tuesday, June 19, 2012 8:44 PM