I am working on windows phone app. In this app I want to start OnInvoke() method of background agent daily at 9 A.M. and want to stop it at 6 P.M automatically daily. How can I do it?
Asked
Active
Viewed 77 times
1 Answers
1
You can't chose when your background agent will run. It will run every 30 minutes or so for about 15 seconds, during the whole day, as long as the phone has enough battery remaining.
But what you can do is, at the beginning of the OnInvoke
method, check the current time. If the current time is not in the required interval, just exit from the method without doing any processing.

Kevin Gosse
- 38,392
- 3
- 78
- 94
-
But according to your suggestion our background agent will run 24*7 . this may lead to more battery consumption.Any other way? – Ritesh Gupta Dec 27 '12 at 12:27