0
votes

I'm struggling with problem with my first winJS app. What I want to do is to update all secondary tiles created by my app in interval of a couple of hours when Internet connection is available. I've managed to do that from my app, using a simple "update" button, but I cannot do that from bg task. As for now I'm testing it on timezone change trigger not to wait half an hour for the result. I put simple console.log at the beginning of the bgtask to confirm that it occurs and it does, but none of the live tiles updates. What piece of information am I missing about updating secondary live tiles from bgtask?

1
Apparently I didn't know about Promises what I should've known. What is important is that you should always make promises when you know something is going to be done asynchronously. I simply wasn't waiting for my promises to be done and completed so my bgtask hadn't have enough time to complete it's tasks.adam

1 Answers

1
votes

Sounds like you've figured it out, but the key piece is the GetDeferral method on the background task instance. You need to call that and then call the Complete method on that only after all your task's work is done (including waiting for promises from any async calls to complete).