Exemplo n.º 1
0
        //private
        private static async void RegisterBackgroundTasks(string appVersion, bool pushEnabled)
        {
            if (!ApplicationData.Current.LocalSettings.Values.ContainsKey(VERSION_STORE_KEY) || (string)ApplicationData.Current.LocalSettings.Values[VERSION_STORE_KEY] != appVersion)
            {
                if (ApplicationData.Current.LocalSettings.Values.ContainsKey(VERSION_STORE_KEY))
                {
                    BackgroundExecutionManager.RemoveAccess();
                }

                if (await BackgroundExecutionManager.RequestAccessAsync() != BackgroundAccessStatus.Denied)
                {
                    ApplicationData.Current.LocalSettings.Values[VERSION_STORE_KEY] = appVersion;
                }
            }

            BackgroundTask.Register();
            if (pushEnabled)
            {
                PushBackgroundTask.Register();
            }
        }
Exemplo n.º 2
0
 public static void EnablePushNotifications(IInitializeHandler handler)
 {
     PushBackgroundTask.Register();
     CreateWNSChannel(handler);
 }