Windows Phone 8 App在后台运行时可以运行的功能-文档功能Windows Phone 8 App在后台运行时可以运行的功能-文档不一致? [英] Features that can be run when Windows Phone 8 App running in background - Documenation Features that can be run when Windows Phone 8 App running in background - Documenation inconsistanc??

查看:56
本文介绍了Windows Phone 8 App在后台运行时可以运行的功能-文档功能Windows Phone 8 App在后台运行时可以运行的功能-文档不一致?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows Phone 8上,应用程序的后台代理可以使用和不能使用哪些功能方面,似乎存在文档不一致的地方.

There appears to be documentation inconsistency relating to what features can and can't be used by an App's background agent on a Windows Phone 8.

例如 http://msdn.microsoft.com/zh-cn/library/windowsphone/develop/hh202962(v=vs.105).aspx 指出在以下情况下不支持Microsoft.Devices.Sensors API: http://msdn.microsoft.com/zh-CN/library/windowsphone/develop/jj662941(v=vs.105).aspx  表示是这样.

For example http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202962(v=vs.105).aspx states that the Microsoft.Devices.Sensors API is not supported while http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj662941(v=vs.105).aspx says it is.

我注意到第一篇文章适用于Windows Phone 8和OS7.1,第二篇文章仅适用于Windows Phone 8.这是否意味着第二篇文章取代了第一篇?

I note that the first article Applies to Windows Phone 8 and OS7.1 where the second only applies to Windows Phone 8.  Does this mean the 2nd article supersedes the 1st?

推荐答案



尽管这两篇文章都讨论了可以在后台执行的任务,但实际上它们是您将在不同情况下使用的两个选项:

Hi,

Although both articles talk about tasks that can be executed in the background they are really two options that you will use in different scenarios:

第一篇文章讨论了后台代理,这些代理基本上是作为计划任务在后台执行的代码.要使用此代理,您需要重写ScheduledTaskAgent类.在这一节中,您不允许运行Microsoft.Devices.Sensors中的任何API 命名空间.
http://msdn.microsoft.com/zh-CN /library/windowsphone/develop/hh202962(v=vs.105).aspx

第二个是指当用户通过单击开始"按钮或启动另一个使当前应用程序进入暂停模式的应用程序离开该应用程序时,您的应用程序将执行的操作.例如位置追踪 允许用户主动继续跟踪您的位置,即使用户离开该应用也是如此.为此,您需要修改应用清单并实现RunningInBackground事件.在这种模式下,您可以使用Microsoft.Devices.Sensors中的API 命名空间:
http://msdn.microsoft.com/zh-CN /library/windowsphone/develop/jj662935(v=vs.105).aspx

First article talks about background agents which is basically code executed in the background as a Scheduled Task. To use this you need to override the ScheduledTaskAgent class. In this one you are not allowed to run any APIs from the Microsoft.Devices.Sensors namespace.
http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202962(v=vs.105).aspx

The second one refers to what your application will do when the user navigates away from the application by clicking the Start button or by launching another app which will make the current app to go in suspended mode. For example a location-tracking app that's allowed to actively continue tracking your location even when the user navigated away from the app. For this one you need to modify the app manifest and implement the RunningInBackground event. In this mode you are allowed to use APIs from the Microsoft.Devices.Sensors namespace:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj662935(v=vs.105).aspx

希望这可以澄清一下.

最好的问候,

Hope this clarifies it a little bit.

Best regards,

克里斯蒂安(Cristhian)

Cristhian


这篇关于Windows Phone 8 App在后台运行时可以运行的功能-文档功能Windows Phone 8 App在后台运行时可以运行的功能-文档不一致?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆