title: Can we call background task using application trigger automatically?
body: <p>I have created an application in UWP for background task using Application trigger. It is working when I trigger the event manually using button.</p>
  
  <p>I want to call the background task event in App minimization using Application trigger. Is it possible?</p>
  
  <p>I used following code to trigger background task with button click:</p>
  
  <pre><code> public MainPage()
      {
          this.InitializeComponent();
          this.Button_Click();
      }
      private void Button_Click(object sender, RoutedEventArgs e)
      {
  
          var taskRegistered = false;
          var exampleTaskName = "ExampleBackgroundtask";
  
          foreach (var task in BackgroundTaskRegistration.AllTasks)
          {
              if (task.Value.Name == exampleTaskName)
              {
                  taskRegistered = true;
                  break;
              }
          }
          if (!taskRegistered)
          {
              var builder = new BackgroundTaskBuilder();
  
              builder.Name = exampleTaskName;
              builder.TaskEntryPoint = "Background.ExampleBackgroundtask";
              builder.SetTrigger(new SystemTrigger(SystemTriggerType.TimeZoneChange, false));
              BackgroundTaskRegistration task = builder.Register();
              task.Completed += new BackgroundTaskCompletedEventHandler(OnCompleted);
          }
      }
  </code></pre>