天蓝色通知中心吐司,单击吐司通知

时间:2019-07-16 14:48:02

标签: .net toast azure-notificationhub

我正在使用azure notificationhub示例代码(https://docs.microsoft.com/en-us/azure/notification-hubs/notification-hubs-windows-store-dotnet-get-started-wns-push-notification),它可以正常工作,

我可以从azure或我设置的后端发送烤面包通知,但是当我单击烤面包(通知中没有按钮)时,它会打开UWP应用程序并显示空白屏幕,该应用程序有没有办法响应对烤面包通知的点击?还是有办法将有效载荷发送到UWP应用程序?

谢谢

编辑:我遵循的示例代码

受保护的覆盖无效void OnLaunched(LaunchActivatedEventArgs e)         {             InitNotificationsAsync();

        Frame rootFrame = Window.Current.Content as Frame;

        // Do not repeat app initialization when the Window already has content,
        // just ensure that the window is active
        if (rootFrame == null)
        {
            // Create a Frame to act as the navigation context and navigate to the first page
            rootFrame = new Frame();

            rootFrame.NavigationFailed += OnNavigationFailed;

            if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                //TODO: Load state from previously suspended application
            }

            // Place the frame in the current Window
            Window.Current.Content = rootFrame;
        }

        if (e.PrelaunchActivated == false)
        {
            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
    }

0 个答案:

没有答案