执行停用后的Windows Phone 8.1应用程序 [英] Execute a Windows Phone 8.1 Application after deactivation

查看:191
本文介绍了执行停用后的Windows Phone 8.1应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道了Windows Phone 8.1的应用程序生命周期:的http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff817008%28v=vs.105%29.aspx

I know about the Windows Phone 8.1 Applications lifecycle: http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff817008%28v=vs.105%29.aspx

不过,有没有可能继续保持活跃,当它不使用(停用后)的应用程序?

But, is it possible to keep active the application when it is not used (after deactivation)?

是否有可能实现WP8.1应用程序发送一些数据到服务器,在predetermined的时间间隔?是否有可能执行code的应用程序,它被关闭的时候?

Is it possible to realize a WP8.1 App that sends some data to a Server at predetermined time intervals? Is it possible to execute code in the App, when it is deactivated?

推荐答案

正如你所标记你的问题的WP8.1,除了的 Silverlight应用程序,也有通用/运行应用。值得一提的是在Windows Phone的8.1运行的应用程序,你有一点点不同的应用程序生命周期

As you have tagged your question for WP8.1, apart from Silverlight apps, there are also Universal/Runtime apps. It's worth to mention that in Windows Phone 8.1 Runtime Apps you have a little different app lifecycle.

什么办法,当你的应用程序正在暂停停用逻辑删除的或投入使用的不运行的的状态时,它被停止。而且也没有办法,它会在后台工作(官方API和除了Audioplayers,GPS跟踪应用程序和其他专门desinged型号为)。一个diffrenet情况下也锁屏下的应用程序的运行(这是可能的,但它不是你所要求的)。当您从您的应用程序导航离开,那么<一个href="http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.ui.xaml.application.suspending.aspx"相对=nofollow>暂停升高或事件(的在WP的Silverlight停用) - 还请注意,你有非常有限的时间与这些事件,以节省您的应用程序的状态

Any way, when your App is being Suspended, Deactivated, Tombstoned or put into Not-Running state, it is being stopped. and there is no way that it will work in Background (with official API and apart from Audioplayers, GPS tracking apps and other specially desinged models for that). A diffrenet case is also an App running under the lock screen (it is possible, but it's not what you are asking for). When you navigate away from your App, then Suspending event is raised or (Deactivated in WP Silverlight) - note also that you have very limited time with those events to save the state of your App.

有办法在后台运行,除了 BackgroundAgents 的,从Windows Phone的8.1起(包括Silverlight和运行时)您可以使用 BackgroundTasks 。它们可以被触发(例如<一href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.background.timetrigger.aspx"相对=nofollow> TimeTrigger ,<一个href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.background.maintenancetrigger.aspx"相对=nofollow> MaintanceTrigger )根据他们的注册 - 在时间间隔和/或在特殊条件

There are ways for working in background, apart from BackgroundAgents, starting from Windows Phone 8.1 (both Silverlight and Runtime) you can use BackgroundTasks. They can be triggered (for example TimeTrigger, MaintanceTrigger) depending on their Registration - in time intervals and/or upon special conditions.

<一个href="http://blogs.msdn.com/b/windowsappdev/archive/2012/05/24/being-productive-in-the-background-background-tasks.aspx"相对=nofollow>这是一个变化好文章,你也可以找到一些信息的在这篇文章

Here is a vary good article, and you can also find some information at this article.

这篇关于执行停用后的Windows Phone 8.1应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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