/// <summary>
        /// Activate or deactive the background task for notification handling
        /// </summary>
        /// <param name="Activate"></param>
        /// <returns>true if activated</returns>
        private async Task <bool> BackgroundTaskActivate(bool Activate)
        {
            try
            {
                BackgroundAccessStatus _status = await BackgroundExecutionManager.RequestAccessAsync();

                if (_status == BackgroundAccessStatus.AllowedMayUseActiveRealTimeConnectivity)
                {
                    var PebbleTimeTaskName = "Pebble Time Background Notifications";

                    //Remove the current registration
                    foreach (var task in BackgroundTaskRegistration.AllTasks)
                    {
                        if (task.Value.Name == PebbleTimeTaskName)
                        {
                            task.Value.Unregister(true);
                        }
                    }

                    if (!Activate)
                    {
                        System.Diagnostics.Debug.WriteLine(String.Format("BackgroundTask Notifications Status: Deactivated"));

                        return(true);
                    }

                    String Result = AccessoryManager.RegisterAccessoryApp();

                    if (await GetAppsFromPhone())
                    {
                        foreach (var item in Apps)
                        {
                            AccessoryManager.EnableNotificationsForApplication(item.ID);
                        }

                        var backgroundTaskBuilder = new BackgroundTaskBuilder();

                        backgroundTaskBuilder.Name           = PebbleTimeTaskName;
                        backgroundTaskBuilder.TaskEntryPoint = "BackgroundTasks.BackgroundNotifications";

                        DeviceManufacturerNotificationTrigger deviceManufacturerNotificationTrigger = new DeviceManufacturerNotificationTrigger(String.Concat("Microsoft.AccessoryManagement.Notification:", Result), false);
                        backgroundTaskBuilder.SetTrigger(deviceManufacturerNotificationTrigger);
                        BackgroundTaskRegistration backgroundTaskRegistration1 = backgroundTaskBuilder.Register();

                        /*WindowsRuntimeMarshal.AddEventHandler<BackgroundTaskCompletedEventHandler>(new Func<BackgroundTaskCompletedEventHandler,
                         *  EventRegistrationToken>(backgroundTaskRegistration1, BackgroundTaskRegistration.add_Completed),
                         *  new Action<EventRegistrationToken>(backgroundTaskRegistration1,
                         *      BackgroundTaskRegistration.remove_Completed),
                         *      new BackgroundTaskCompletedEventHandler(this.registration_Completed));*/

                        SetNotificationTypes();

                        // PhoneAppsList();

                        System.Diagnostics.Debug.WriteLine(String.Format("BackgroundTask Notifications Status: Activated"));

                        return(true);
                    }
                    else
                    {
                        ExtendedEventArgs eaa = new ExtendedEventArgs();
                        eaa.Error = String.Format("Notifications access denied.");
                        OnFatalError(eaa);

                        _BackgroundTaskEnabled = false;
                        NotifyPropertyChanged("BackgroundTaskEnabled");
                        NotifyPropertyChanged("NotificationAppsEnabled");
                    }
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("BackgroundTask Notifications Exception: " + e.Message);

                ExtendedEventArgs eaa = new ExtendedEventArgs();
                eaa.Error = String.Format("A fatal error occurred: {0}", e.Message);
                #if DEBUG
                eaa.Error = String.Format("A fatal error occurred. {1}:{0}", e.Message, e.Source);
                #endif
                OnFatalError(eaa);
            }

            return(false);
        }