Show notification banner only..

MangoApps 91 Reputation points
2019-12-23T09:00:00.023+00:00

I want to show notification banner only and don't want to add my notification in action center.. for some notifications.

Is there any API where I can decide this to add in the action center or not

Universal Windows Platform (UWP)
{count} votes

2 answers

Sort by: Most helpful
  1. Richard Zhang-MSFT 6,936 Reputation points
    2019-12-23T09:25:34.64+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    In UWP, Toast Notification is sent via ToastNotifier, which will inevitably leave a record in the action center.

    But you can try to remove history after notification:

    private async void SendNotificationWithoutHistory(ToastNotification toast)
    {
        toast.Tag = "testTag";
        var notifier = ToastNotificationManager.CreateToastNotifier();
        notifier.Show(toast);
        await Task.Delay(3000);
        ToastNotificationManager.History.Remove("testTag");
    }
    

    In this code, we first display a notification and then remove it from the action center after 3 seconds.

    But currently, there is no API that can only show notifications without keeping records.

    Thanks

    1 person found this answer helpful.
    0 comments No comments

  2. macintoshpro 36 Reputation points
    2020-01-08T14:05:52.357+00:00

    You can try InAppNotification from Windows Community Toolkit (https://github.com/windows-toolkit/WindowsCommunityToolkit). It provide notification within app, easier to call

    // Show notification with simple text (and a duration of 2 seconds)
    int duration = 2000;
    ExampleInAppNotification.Show("Some text.", duration);
    
    0 comments No comments