开发者

Windows Phone 7 (Mango) App gets disconnected when put in background?

Ca开发者_运维技巧n I prevent my application from having the sockets closed when the user puts it in the background on Windows Phone 7 Mango?

If so, how would I go about doing it?

Thanks


No, you cannot keep a persistent socket connection open when your application is not running, even in Mango.

You can:

  • Create a PeriodicTask that will be called every 30 minutes, but can only execute for 10-15 seconds before being killed
  • Create a ResourceIntensiveTask that will run when the phone is connected to power and will execute for as long as you like (or until the phone is disconnected from power)

Both types of task have access to your application's isolated storage but will execute in a separate application domain, so it won't have access to variables and other application state.


you should implement a background task - there is a sample on the interwebz on how to do that

-- edit -- but still that will be called every 30 minutes sooo... unless you are streaming something (there is a specifi task for that) you are out of luck

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜