그래서 저는 Windows 스토어 응용 프로그램에서 백그라운드 작업을하는 데 문제가있는 것 같습니다. 필자는 튜토리얼 백서를 따라 갔고 Microsoft의 샘플 코드와 모든 코드 반복 작업이 실패한 것처럼 보였지만 사라졌습니다. Visual Studio는 백그라운드 작업이 실행되지 않는 오류를주지 않으며, 인터넷 연결이있을 때마다 70 분마다 실행하는 것이 목적입니다.Windows 8 백그라운드 작업
코드의 범위는 아래에 자신의 프로젝트라는 작업에있어, 그리고 (안이 프로젝트하지만 솔루션의 주요 프로젝트에 대한) 제대로 백그라운드 작업이 가득 매니페스트이 클래스에서 찾을 수
class BackroundBuilder
{
public BackroundBuilder()
{
this.RegisterTimeTriggerBackgroundTask();
}
//this is the code that registers my backround task to run a trigger
//was added for testing.
private bool RegisterTimeTriggerBackgroundTask()
{
BackgroundTaskBuilder builder = new BackgroundTaskBuilder();
builder.Name = "Background task test";
builder.TaskEntryPoint = "PostPage.xmal";
// Run every 70 minutes if the device has internet connectivity
IBackgroundTrigger trigger = new TimeTrigger(70, false);
builder.SetTrigger(trigger);
IBackgroundCondition condition = new
SystemCondition(SystemConditionType.InternetAvailable);
//this is the trigger it's set to fire when internet becomes available
IBackgroundTrigger Itrigger = new
SystemTrigger(SystemTriggerType.InternetAvailable,true);
builder.SetTrigger(Itrigger);
builder.AddCondition(condition);
IBackgroundTaskRegistration task = builder.Register();
return true;
}
public async void Run(IBackgroundTaskInstance taskInstance)
{
BackgroundTaskDeferral _deferral = taskInstance.GetDeferral();
//WindowsBlogReader.FeedDataSource updateAll = new WindowsBlogReader.FeedDataSource();
//direct input for the test string is declared below but the updateAll declaration
// above is the one that will be used once the test works
WindowsBlogReader.LiveTileTimeUpdate updateAll = new WindowsBlogReader.LiveTileTimeUpdae();
//this is the test to see if the background task will fire
//await was in front of the below statement but im injecting that String into a method
//that is not setup for async the method being used once this works is an async
updateAll.update("Background task fired");
//this update method adds a String too the list of Sting that's the live tile cycles though
_deferral.Complete();
}
}
이 어떤 도움을 주시면 감사하겠습니다
<Extension Category="windows.backgroundTasks" EntryPoint="Tasks.BackroundBuilder">
<BackgroundTasks>
<Task Type="systemEvent" />
<Task Type="timer" />
</BackgroundTasks>
</Extension>
매니페스트 XML 코드를입니다. 이 코드가 충분한 정보가 아니라면 더 많은 정보를 얻을 수 있습니다. 앱이 실행 중일 때 모든 기능이 작동하므로 앱의 다른 부분에는 알려진 (알려진) 문제가 없습니다.
백그라운드 작업 선언과 관련된 매니페스트의 XML 코드를 추가했습니다. –