Any Tips for getting Windows Phone 8 Resource Intensive Task to Run?

ぃ、小莉子 提交于 2019-12-07 11:11:02

问题


I have been trying to get a Resource-Intensive Task background agent to run in release mode after deploying to the phone for several days and have never seen it run. Has anyone got this to work outside of the debugger? How long did you have to wait before it ran?

I am able to launch and successfully run the Resource-Intensive Task using the LaunchForTest but have never gotten it to run as it should in release mode even though the task shows that it is scheduled. I have followed the samples and the phone should have met the requirements for launch. I have set the manifest up for auto-upload as well so shouldn't need to set an expiration date on the task.

The phone is plugged in and charging and battery is 100%. The phone has wifi access. The phone is on the lock screen and left this way over night for 2 nights.

I have tried this both on a Nokia Lumia 920 and HTC699OL

I am able to get a Periodic Task to run but not the Resource-Intensive Task. If the Periodic runs, I'm assuming I have configured everything correctly in the WMAppManifest and the Resource-Intensive Task should run at some point?

The Resource-Intensive Task shows the following:

  • IsEnabled = true
  • IsShceduled = true
  • LastScheduledTime: 1/1/0001 12:00:00
  • ExpirationTime: 12/31/9999 11:59:59
  • LastExitReason: None

The app shows up in the Settings > Background tasks > advanced.

Running the Store Kit test shows no API call problems for the phone application and I have a reference to the agent project from the main phone app project.

Here is my WMAppManifest setting for the agent:

<ExtendedTask Name="BackgroundTask">
    <BackgroundServiceAgent Name="SML.Sync.WP8.Agent" Specifier="ScheduledTaskAgent" Source="SML.Sync.WP8.Agent" Type="SML.Sync.WP8.Agent.BackgroundUploadAgent" />
</ExtendedTask>

This seems correct based on the MSDN documentation here: MSDN Task Element documentation

Here is the auto-upload extension, which follows the Tokens node:

<Extensions>
  <Extension ExtensionName="Photos_Auto_Upload" ConsumerID="{5B04B775-356B-4AA0-AAF8-6491FFEA5632}" TaskID="_default" />
</Extensions>

I have also tried it without the auto-upload setting and had the same result of never running.

I have also tried getting the example from here http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202941(v=vs.105).aspx to run but after removing the debug_agent and deploying as release mode, I see the same issue, never gets run even though it says its scheduled - periodic does run just not resource-intensive.

I know that the documentation says that it may never run but it seems like 2 days passing and meeting the task requirements should work. Do I need to wait a week to see if this sucker runs?

Would be greatly appreciative of any guidance or tips if you have gotten a Resource-Intensive task to actually run in release mode.


回答1:


I opened a support incident with Microsoft on February 4th 2013 and heard back from them February 5th with the following:

I collaborated with the internal Windows Phone developers and confirmed the following:

  1. ResourceIntensiveTask (i.e. Resource Intensive Agent) does not get triggered in the Windows Phone 8 operating system in Release Mode.
  2. FYI, Auto-upload uses ResourceIntensiveTasks, so it does not work in WP8 either.
  3. A fix is scheduled for inclusion in a future Windows OS update, most likely later this spring. The fix needs to propagate through the OEMs who build their hardware-specific versions of the Windows Phone 8 OS.
  4. There is no known immediate/official workaround.



回答2:


The recent GDR2 update has fixed this. I verified that Resource-Intensive Task is running on my phone.




回答3:


If you want to upload something in background, maybe you dont even need this Task. You could give this a try:

http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202955%28v=vs.105%29.aspx

Sample is here:

http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202959%28v=vs.105%29.aspx



来源:https://stackoverflow.com/questions/14664796/any-tips-for-getting-windows-phone-8-resource-intensive-task-to-run

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!