简体   繁体   English

后台代理Windows Phone 8仅运行一次?

[英]Background Agent Windows Phone 8 run only once?

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? 我没有在Windows Phone中使用后台代理的经验,我只是好奇是否可以启动后台代理并使其仅运行一次? 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 感谢名单

The background agent will run every 30 minutes. 后台代理将每30分钟运行一次。 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. 尽管如此,如果您只是在启动时进行快速检查,决定不运行它并立即调用NotifyComplete方法,那么对电话的影响应该可以忽略不计。 Therefore, I wouldn't worry too much about it. 因此,我不会对此太担心。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM