c# - How to use Time Trigger in background task in Windows 8 JS Metro App -
i have requirement have call service in background after every let 1 hour informations server. working on javascript metro application. have tried background task , used time trigger , have scheduled triggered in every 15 minutes. called first time , never called. didn't close background task because want run time , call service @ scheduled time. have used microsoft background task sample reference.
please tell me should best approach call service in background. how use time trigger , why time trigger doesn't called after first time?
please share code sample or walkthrough if any.
thanks
first thing should close background task instructed in documentation - if tasks don't behave nicely, platform might suspend , refuse run them time. should let platform handle triggering of events based on triggers , conditions define instead of trying bend system. also, remember there's cpu , data usage quotas background tasks present, 1 can't massive amount of processing in background tasks - if quotas exceeded, tasks suspended. sure background task works , doesn't throw errors.
in general, recommendation 1 shouldn't rely solely on background tasks fetch information since it's not guaranteed manage on time, better prepare downloading needed data in foreground app well. depends on use case: if data fetched in background tasks not critical more nice-to-have, there's less worry about.
the timetrigger requires app being added lock screen (see docs), guess meet requirement since you've managed task running once.
for debugging background tasks, please take @ event viewer, see detailed instructions. page contains tips common problems. event viewer entry mentioned in document valuable resource figuring out problems bg task execution. guess you'll see errors there related not closing task properly.
Comments
Post a Comment