甚至在后台执行任务 [英] Execute task even in the background

查看:161
本文介绍了甚至在后台执行任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
如何在Windows手机在后台运行的应用程序?

我调查的Windows Phone 8 SKD关于如何创建任务实例(FTP写要精确),将定期执行,即使该应用程序在后台运行。

I am investigating Windows Phone 8 SKD for examples on how to create a task (FTP write to be precise) that would be executed periodically even if the application is in the background.

的文档指出我的后台代理的,因为后台传输服务
仅支持使用传输的HTTP和HTTPS,FTP协议不支持。我一直在尝试和测试样品,一切工作除了事实,后台代理事件时间不能设置(或多或少)。根据该文件定期剂通常运行,每30分钟,并没有方法/类/构造函数有一个时间/日期参数。你有ScheduledActionService.LaunchForTest(任务,时间),但它仅在调试时使用,而不是在生产,而且可以使MS拒绝从市场上您的应用程序。

The documentation points me to Background Agents because the Background Transfer Service "only supports transfers using HTTP and HTTPS. FTP is unsupported". I have been trying and testing the samples, everything is working (more or less) except for the fact that Background Agent event time cannot be setup. According to the documentation "Periodic agents typically run every 30 minutes" and no method/class/constructor has a time/date parameter. You have ScheduledActionService.LaunchForTest(task, Time) but it is to be used only during debug time, not in production, and can make MS reject your app from the market.

是否有任何解决方案或变通方法,使我的经纪人火了每分钟?

Is there any solution or workaround to make my agent fire up every minute?

推荐答案

您不能使每1分钟你的应用程序execude代码时,它不是在前台运行过程中出现。通常你会使用后台执行所谓的PeriodicTask或ResourceIntensiveTask。第一个运行,每〜28分钟后,可以使用不超过6MB的内存(在WP8 11MB),并必须完成〜20秒内执行。第二个可以运行更长的时间和更大的内存,但它有喜欢这款手机的Wi-Fi信号有些吃紧要求,充电器,等...

You cannot make your app execude code every 1 minute when it's not runnig in foreground. Usually you would use for background execution so called PeriodicTask or ResourceIntensiveTask. The first one runs every ~28 minute, can use no more than 6MB of memory (11MB on WP8) and must finish the execution within ~20 seconds. The second one can run for longer time and use more memory, but it has some tight requirements like phone on Wi-Fi signal, on charger, etc...

另一个你可以在WP8做的事情正在实施,可以在后台运行,如果它积极跟踪用户的位置定位跟踪应用程序。如果你的应用程序基于位置,你可以用这个和下载任何你想要的每1分钟。但是如果你的应用程序不是基于位置的,你最有可能的运气

Another thing you can do on WP8 is implementing Location Tracking app that can run in background if it's actively tracking user's location. If your app is location based, you can use this and download whatever you want every 1 minute. But if your app is not location based, you're most likely out of luck.

如何使用位置跟踪和后台执行的WP8:结果
http://msdn.microsoft.com/en-美国/库/ WindowsPhone的/开发/ jj681691(v = vs.105)的.aspx

How to use location tracking and background execution in WP8:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj681691(v=vs.105).aspx

这篇关于甚至在后台执行任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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