Background agent
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的更多相关文章
- 例子:Background Agent Sample
通过本例程学习: 后台代理Agent的使用方法 定期代理(PeriodicTask)来说,限制了: 有一些API不能使用,并不是说你不调用就可以了,只要你在同一个程序集里使用了这些API,就不会通过验 ...
- Windows phone应用开发[17]-xap提交异常处理
在windows phone 应用提交操作上早在2011年时就写过一篇Windows phone 应用开发[4]-应用发布,那时wp应用提交官方市场的流程繁杂[超过了5步].因为上传和填写应用信息页面 ...
- wp8 入门到精通 WebClient Post
WebClient wc = new WebClient(); var URI = new Uri("http://your_uri_goes_here"); //If any e ...
- Windows Phone 8 - Runtime Location API - 2
原文:Windows Phone 8 - Runtime Location API - 2 在<Windows Phone 8 - Runtime Location API - 1>介绍基 ...
- Windows Phone 8 - Runtime Location API - 1
原文:Windows Phone 8 - Runtime Location API - 1 在Windows Phone里要做Background Service的方式,除了Background Ag ...
- 【RDA】使用RDA(Remote Diagnostic Agent)工具对数据库进行健康检查
[RDA]使用RDA(Remote Diagnostic Agent)工具对数据库进行健康检查 分类: Linux RDA英文全称叫做"Oracle Remote Diagnostic Ag ...
- 例子:Background Audio Streamer Sample
The Background Audio Streamer sample demonstrates how to create an app that uses a MediaStreamSource ...
- 浏览器默认样式(user agent stylesheet)+cssreset
每种浏览器都有一套默认的样式表,即user agent stylesheet,在写网页时,没有指定的样式,按浏览器内置的样式表来渲染.这是合理的,像word中也有一些预留样式,可以让我们的排版更美观整 ...
- Cloudinsight Agent install script
#!/bin/bash # Cloudinsight Agent install script. set -e logfile="ci-agent-install.log" gis ...
随机推荐
- hdu 4751 2013南京赛区网络赛 二分图判断 **
和以前做过的一个二分图颇为相似,以前的是互相不认识的放在一组,这个是互相认识的,本质上是相同的 是 hdu 2444 #include<cstdio> #include<iostre ...
- hdu 4291 2012成都赛区网络赛 矩阵快速幂 ***
分析:假设g(g(g(n)))=g(x),x可能非常大,但是由于mod 10^9+7,所以可以求出x的循环节 求出x的循环节后,假设g(g(g(n)))=g(x)=g(g(y)),即x=g(y),y也 ...
- Effective C++ 之 Item 6 : 若不想使用编译器自动生成的函数,就该明确拒绝
Effective C++ chapter 2. 构造 / 析构 / 赋值运算 (Constructors, Destructors, and Assignment Operators) Item 6 ...
- vector 之删除元素
删除指定位置的元素 删除vector中第5个位置的元素 vector<int> vec; //执行vector初始化操作 vector<; //获取第五个元素的iterator ve ...
- javascript 简单加解密
//加密 function MyEncrypt(txt) { var sb = ""; var rand = 0; for (var i=0;i<txt.length;i++ ...
- HDU 5875 Function st + 二分
Function Problem Description The shorter, the simpler. With this problem, you should be convinced ...
- Codeforces Alpha Round #20 (Codeforces format) C. Dijkstra?(裸的dijkstra)
题目链接:http://codeforces.com/problemset/problem/20/C 思路:需要用优化过的dijkstra,提供两种写法. #include <iostream& ...
- linux下SVN忽略文件/文件夹的方法
linux下SVN忽略文件/文件夹的方法 假设想忽略文件temp 1. cd到temp所在的目录下: 2. svn propedit svn:ignore . 注意:请别漏掉最后的点(.表示当前目录) ...
- Java优化之输出十万以内的质数
(1)未经优化时所耗费的时间: public class PrimeNumber { public static void main(String[] args) { long start = Sys ...
- for循环嵌套
今天复习了分支语句以及for循环,新内容主要讲解了for循环的嵌套: 外循环控制行,内循环控制列 下面几个实例: 五行五列的矩阵 左下角是直角的三角形: 左上角是直角的三角形: 右上角为直角的三角形: ...