locked
timer based background task running at irregular times

    Question

  •  try
                    {
                        await BackgroundExecutionManager.RequestAccessAsync();
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine(ex.Message);
                    }
    
                    RegisterBackgroundTask(Constants.PrioritySelectionBackgroundTaskEntry,
                                                                               Constants.PrioritySelectionBackgroundTaskName,
                                                                               new TimeTrigger(16, false), 
                                                                               new SystemCondition(SystemConditionType.InternetAvailable)

    With the above code , I am able to run the background task .But the time at which it runs is sometimes less tha

    16 minutes ,sometimes it is more that that .I want it to run this at exactly 16 minutes



    Regards, Rahul Jaiswal

    Saturday, April 5, 2014 11:49 AM

All replies

  • You cannot control it that precisely. From the TimeTrigger docs:

    The system schedules the task within 15 minutes after FreshnessTime elapses.

    --Rob
    Saturday, April 5, 2014 2:53 PM
    Owner
  • Hi Rob,

    This means that, if have set the trigger time as 15 min than BG task can be triggered any time in between 15-30 mins. But why it is being trigger in less than 15 mins.

    I have found that sometimes it get called very frequently i.e. in time interval of 1 min. Verified in system event logs.


    Regards, Rahul Jaiswal


    Saturday, April 5, 2014 4:45 PM