Periodic Task

Periodic agents run for a small amount of time on a regular recurring interval. Typical scenarios for this type of task include uploading the device’s location and performing small amounts of data synchronization.

ResourceIntensive Task

Resource-intensive agents run for a relatively long period of time when the phone meets a set of requirements relating to processor activity, power source, and network connection. A typical scenario for this type of task is synchronizing large amounts of data to the phone while it is not being actively used by the user.

Life cycle

The code for the agent is implemented by the application in a class that inherits from BackgroundAgent.

When the agent is launched, the operating system calls OnInvoke(ScheduledTask). In this method, the application can determine which type of ScheduledTask it is being run as, and perform the appropriate actions.

When the agent has completed its task, it should call NotifyComplete() or Abort() to let the operating system know that it has completed. NotifyComplete should be used if the task was successful. If the agent is unable to perform its task – such as a needed server being unavailable - the agent should call Abort, which causes the IsScheduledproperty to be set to false.

The foreground application can check this property when it is running to determine whether Abort was called.

1. WMAppmanifest.xml configuration

2. App.xaml.cs, App_Launching/App_Closing

3. Reference to Schedule Agent project

4. Write code in .cs file

Background agent的更多相关文章

  1. 例子:Background Agent Sample

    通过本例程学习: 后台代理Agent的使用方法 定期代理(PeriodicTask)来说,限制了: 有一些API不能使用,并不是说你不调用就可以了,只要你在同一个程序集里使用了这些API,就不会通过验 ...

  2. Windows phone应用开发[17]-xap提交异常处理

    在windows phone 应用提交操作上早在2011年时就写过一篇Windows phone 应用开发[4]-应用发布,那时wp应用提交官方市场的流程繁杂[超过了5步].因为上传和填写应用信息页面 ...

  3. wp8 入门到精通 WebClient Post

    WebClient wc = new WebClient(); var URI = new Uri("http://your_uri_goes_here"); //If any e ...

  4. Windows Phone 8 - Runtime Location API - 2

    原文:Windows Phone 8 - Runtime Location API - 2 在<Windows Phone 8 - Runtime Location API - 1>介绍基 ...

  5. Windows Phone 8 - Runtime Location API - 1

    原文:Windows Phone 8 - Runtime Location API - 1 在Windows Phone里要做Background Service的方式,除了Background Ag ...

  6. 【RDA】使用RDA(Remote Diagnostic Agent)工具对数据库进行健康检查

    [RDA]使用RDA(Remote Diagnostic Agent)工具对数据库进行健康检查 分类: Linux RDA英文全称叫做"Oracle Remote Diagnostic Ag ...

  7. 例子:Background Audio Streamer Sample

    The Background Audio Streamer sample demonstrates how to create an app that uses a MediaStreamSource ...

  8. 浏览器默认样式(user agent stylesheet)+cssreset

    每种浏览器都有一套默认的样式表,即user agent stylesheet,在写网页时,没有指定的样式,按浏览器内置的样式表来渲染.这是合理的,像word中也有一些预留样式,可以让我们的排版更美观整 ...

  9. Cloudinsight Agent install script

    #!/bin/bash # Cloudinsight Agent install script. set -e logfile="ci-agent-install.log" gis ...

随机推荐

  1. [Tools] 设置surface上的VPN

    [背景] 继续前对机器进行配置安装,这次是VPN在win8上的设置,又跟xp不一样,看来要慢慢适应win8的日子,呵呵 [开工] 首先按照原先在win xp上的步骤一步步来配置 选择connect t ...

  2. 从github下载某个git库的4种方法

    转自:http://blog.csdn.net/feiniao1221/article/details/7516421 以gerrit-trigger-plugin为例,下面的链接都是从相应页面上直接 ...

  3. (转载)一个用于Gnome桌面的下拉式终端: Guake 0.7.0 发布

    转自:https://linux.cn/article-5507-1.html Linux的命令行是最好.最强大的东西,它使新手着迷,并为老手和极客的提供极其强大的功能.那些在服务器和生产环境下工作的 ...

  4. 【转】Hive配置文件中配置项的含义详解(收藏版)

    http://www.aboutyun.com/thread-7548-1-1.html 这里面列出了hive几乎所有的配置项,下面问题只是说出了几种配置项目的作用.更多内容,可以查看内容问题导读:1 ...

  5. WebApi多数据库切换

    用抽象工厂来解决多数据库之间的切换问题是普遍的,像以下几篇文章都讲的很具体 申明之前写的存在强大漏洞 -- 之前有涉及到IoC Autofac的知识点,鄙人孤陋寡闻,在亲身实践后才发现其中奥妙可参照一 ...

  6. Java利用POI导入导出Excel中的数据

         首先谈一下今天发生的一件开心的事,本着一颗android的心我被分配到了PB组,身在曹营心在汉啊!好吧,今天要记录和分享的是Java利用POI导入导出Excel中的数据.下面POI包的下载地 ...

  7. ps命令使用 进程查看

    ps命令是Process Status的缩写 用来列出系统中当前运行的那些进程.ps命令列出的是当前那些进程的快照,就是执行ps命令的那个时刻的那些进程,如果想要动态的显示进程信息,就可以使用top命 ...

  8. http://www.cnblogs.com/itsource/p/4266905.html

    http://www.cnblogs.com/itsource/p/4266905.html

  9. KMP(fail数组应用) LA 3026 Period

    题目传送门 题意:(训练指南P213) 求每个前缀的最短循环节 分析:利用失配函数的性质,如果i % (i - fail[i]) == 0,那么正好错位移动一个循环节长度. #include < ...

  10. iOS __strong __weak @Strongify @Weakify

    @Strongify,@Weakify主要是在block中使用. 因为block一般都在对象内部声明.. 如果在block内部使用了当前对象的属性,就会造成循环引用(block拥有当前对象的地址,而当 ...