Question

I do not have any experience with the background agent in windows phone, I am just curious if it is possible to start the background agent and let it run only once? cause according to the research I did it will run every few seconds.

Is there perhaps a property I can set to let it run only once? at the moment the only way I am doing this is removing the agent at the point in code where it is not necessary anymore, but I don't think it is the correct way to do it?

thanx

Was it helpful?

Solution

The background agent will run every 30 minutes. I don't think it can disable itself (except if it crashes, but sounds like a bad practice), so there's probably no way to run it only once. Still, if it you just make a quick check when it starts, decide that it shouldn't run, and immediately call the NotifyComplete method, the impact on the phone should be negligible. Therefore, I wouldn't worry too much about it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top