locked
Getting "The parameter is incorrect" when register a TimeTrigger

    Question

  • The error break out when I'm trying to register this TimeTrigger.How can I implement this feature?

     try {
                var myTaskBuilder = new Windows.ApplicationModel.Background.BackgroundTaskBuilder();
                var myTrigger = new Windows.ApplicationModel.Background.TimeTrigger(1, false);
                var condition = new Windows.ApplicationModel.Background.SystemCondition(Windows.ApplicationModel.Background.SystemConditionType.None);
                myTaskBuilder.addCondition(condition);
                myTaskBuilder.setTrigger(myTrigger);
                myTaskBuilder.name = "EMTimeTrigger";
                myTaskBuilder.taskEntryPoint = "backgroundTask.js";
                
                var task = myTaskBuilder.register();
    
                task.addEventListener("progress", task_Progress);
                task.addEventListener("completed", task_Completed);
    
                //myTask.addEventListener("progress", new ProgressHandler(myTask).onProgress);
                //myTask.addEventListener("completed", new CompleteHandler(myTask).onCompleted);
    
            } catch (ex) {
                console.log(ex.toString());
            }
    


     

    Wednesday, January 04, 2012 8:46 AM

Answers