我尝试从我的设备获取所有通知,但我无法获取应用程序的名称。
UserNotificationListener notificationListener = UserNotificationListener.Current;
UserNotificationListenerAccessStatus accessStatus = await notificationListener.RequestAccessAsync();
if (accessStatus == UserNotificationListenerAccessStatus.Allowed)
{
var notifications = await notificationListener.GetNotificationsAsync(NotificationKinds.Toast);
foreach (var notification in notifications)
{
// Here is exception
System.Diagnostics.Debug.WriteLine(notification.AppInfo.DisplayInfo);
}
}当我上诉到AppInfo property时,我得到了NotImplementedException。我哪里错了?
发布于 2018-06-26 00:42:35
某些通知将无法检索应用程序信息。在文档中,建议将与处理单个通知相关的所有代码包含在try/catch中,因此...
我们建议在try/catch中包含处理单个通知的所有代码,以防捕获单个通知时发生意外异常。您不应该仅仅因为一个特定通知的问题而完全无法显示其他通知。
如果您确定通知来自哪个应用程序,并让我们知道,我们可以尝试解决此问题。这些通常是Win32应用程序。谢谢!
https://stackoverflow.com/questions/51008022
复制相似问题