3
votes

I am Working on windows phone 8.1 background tasks API. As see in all the other threads of background task API here on stack overflow, there is no definite answer to how long the background task runs, as in we cannot map the 2 CPU seconds to the wall clock time. That means it can exit abruptly.

So my question is, is there an handler that we can use to make sure that the application see why the background task ended abruptly. Probably log the events of action and reason for the exit ?

1
From the Build session on background tasks I was under the impression the only time a background task would be rudely terminated was if the system was under memory pressure. In Win8.1 when a background task has reached it cpu quota the task is suspended until the quota is replenished and there was no indication that there was any difference in the build talk. IBackgroundTaskInstance has Cancelled event which allows you to access the BackgroundTaskCancellationReason.Tim
@PaulZahra seriously ? that quest was asked a year ago and the new question was asked 12 days back.golldy
Just a thought to tidy up SO... when they were asked is kinda irrelevant ... they both cover the same subject matter and this one hasn't even been answered... what point do you see in keeping this question?Paul Zahra

1 Answers

0
votes

I just use console.log while the background task is running, keeping in debug mode to see the console, and can therefore pinpoint exactly where the background task crashed. Once you know where, validate your code and look for any errors. If you find none, you probably ran out of memory and the task was cancelled.