Exemplo n.º 1
0
        async void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            if (!BackgroundTaskHelper.CheckBackgroundTaskActive())
            {
                //
                // Seek permission for registering the task
                //
                var accessResult = await BackgroundExecutionManager.RequestAccessAsync();

                if (accessResult == BackgroundAccessStatus.AllowedWithAlwaysOnRealTimeConnectivity ||
                    accessResult == BackgroundAccessStatus.AllowedMayUseActiveRealTimeConnectivity)
                {
                    BackgroundTaskHelper.ActivateTimeTrigger();
                }
            }

            // tile notifications
            await Task.Run(() =>
            {
                ApproxTileUpdater.ScheduleLiveTileUpdates();
                ApproxTileUpdater.UpdateLiveTiles();
            });
        }