Beispiel #1
0
        protected override void OnBackgroundActivated(BackgroundActivatedEventArgs args)
        {
            base.OnBackgroundActivated(args);

            // you have to create those services manually as IoC Provider is not ready yet...
            // application is launched from background (it ws closed before executing that)
            // mvvmcross does not have good bakground actiation support for UWP..

            IUniversalWindowsRemoteNotificationsPresenter remoteNotificationsPresenter =
                new UniversalWindowsRemoteNotificationsPresenter(new UWPRemoteNotificationIdProvider(), new UniversalWindowsPresenterConfiguration(
                                                                     new BadgeNotificationsIdProvider(),
                                                                     new ToastNotificationsIdProvider(),
                                                                     new TileNotificationsIdProvider()
                                                                     ));
            INotificationsService notificationsService =
                new UWPRemotePushNotificationsService(new BackendBasedRemotePushRegistrationService(new AppRestService(() => new HttpClient())),
                                                      new PushTagsProviderService(), remoteNotificationsPresenter);

            PushServicesExtensions.HandlePushRelatedBackgroundActivation(args, remoteNotificationsPresenter, notificationsService);
        }