简体   繁体   English

如何以编程方式从Windows Phone 8.1清除通知

[英]How to clear notifications from windows phone 8.1 programmatically

In windows phone 8.1 all the notifications don't get clear when we open the app by tapping on the notification 在Windows Phone 8.1中,当我们通过点击通知打开应用程序时,所有通知都不会清除

在此处输入图片说明

So I am trying to clear my app's push notifications programmatically in the OnAppLaunched event 所以我试图在OnAppLaunched事件中以编程方式清除我的应用程序的推送通知

private void OnAppLaunched(object state)
{
    var toastNotificationManager = Windows.UI.Notifications.ToastNotificationManager.History;
    toastNotificationManager.Clear();
}

But it is not working from me. 但这对我没有用。 So can anyone help me with this ? 那么有人可以帮我吗?

The Clear method deletes all the notifications created by your app only. Clear方法仅删除您的应用创建的所有通知。 There are a couple more clear methods (see the docs ), but there is none to clear all the notifications from all the apps. 有两种更清晰的方法(请参阅docs ),但是没有一种方法可以清除所有应用程序中的所有通知。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM