博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Background agent
阅读量:6611 次
发布时间:2019-06-24

本文共 1499 字,大约阅读时间需要 4 分钟。

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 .

When the agent is launched, the operating system calls . 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  or  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 property 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

转载于:https://www.cnblogs.com/MinieGoGo/p/3394386.html

你可能感兴趣的文章
2018.5.7每天一题面试题----面向对象的特征
查看>>
Jquery 弹出框出插件 仿IOS效果
查看>>
paper 8:支持向量机系列五:Numerical Optimization —— 简要介绍求解求解 SVM 的数值优化算法。...
查看>>
第八条:覆盖equals时请遵守通用约定
查看>>
flask_sqlalchemy的使用
查看>>
eclipse 常用快捷键
查看>>
PHP开发调试环境配置
查看>>
ElasticSearch客户端注解使用介绍
查看>>
html5 css练习 画廊 元素旋转
查看>>
看博客学学Android(十二)
查看>>
HashMap[转]
查看>>
运算符及优先级 表
查看>>
String类
查看>>
《编写可维护的JavaScript》——JavaScript编码规范(二)
查看>>
NSDateComponents
查看>>
Sparse low rank approximation
查看>>
在 Ubuntu 系统安装 Redi laravel 5.2 引入第三方类
查看>>
[C#]判断回文串;数组中最大最小值,平均值
查看>>
iOS中UIButton的titleEdgeInsets和imageEdgeInsets
查看>>
TestNG基本注解
查看>>