0

我已经编写了一个按需读取 qr/barcode 的代码。但是,当系统警报响起时,我需要后台代理来运行这段代码/应用程序。我一直想不出该怎么做。

4

1 回答 1

2

您无法从后台代理启动程序。您可以更新 Live Tiles 或显示 Shell toast 或从后台代理执行少量后台任务。

Windows phone 8 有两种类型的代理 - 1) PeriodicTask & 2)ResourceIntensiveTask

PeriodicTask: Periodic agents run for a small amount of time on a regular recurring interval.Periodic agents typically run every 30 minutes. To optimize battery life, periodic agents may be run in alignment with other background processes and therefore the execution time may drift by up to 10 minutes.Periodic agents typically run for 25 seconds. There are other constraints that may cause an agent to be terminated early. 

ResourceIntensiveTask: 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. Resource-intensive agents typically run for 10 minutes. There are other constraints that may cause an agent to be terminated early.Resource-intensive agents do not run unless the device has a network connection over Wi-Fi or through a connection to a PC.Resource-intensive agents do not run unless the device’s battery power is greater than 90%. 

更多请阅读代理

于 2013-08-24T17:51:49.410 回答