当 Windows(手机)8.1 应用位于前台时接收和处理通知参数
本文关键字:处理 通知 前台 参数 于前台 手机 Windows 应用 | 更新日期: 2023-09-27 18:36:15
当我收到通知并在徽章上或从通知中心顶部时,应用程序将打开,并在App.xaml.cs
文件中显示OnLaunched(LaunchActivatedEventArgs e)
。我从e.Arguments
那里获取论点,并做任何我想做的事情。
当我收到通知并且我在应用程序中(在前台)时,有没有办法获取这些参数?
试试这个解决方案:
PushNotificationChannel currentChannel = myChannel;
currentChannel.PushNotificationReceived += OnPushNotificationReceived;
void OnPushNotificationReceived(PushNotificationChannel sender, PushNotificationReceivedEventArgs e)
{
e.Cancel = true; // True to prevent default processing of the notification by Windows
// implement your logic there
}