Why AppNotification does not show on desktop randomly?

aluzi liu 486 Reputation points
2023-06-14T09:26:34.6166667+00:00

I have a WinUI3 project, I send notification using this code:

            var builder = new AppNotificationBuilder()
                .AddArgument("Action", "NewToast")
                .AddArgument("ActionData", "ToastData");

            builder.SetAppLogoOverride(new Uri("d:\\photo\\228-01.jpg"), AppNotificationImageCrop.Circle);

            builder.SetScenario(AppNotificationScenario.IncomingCall);
            builder.AddText("test001")
            .AddText("text002")
            .AddText("text003");
            AppNotificationManager.Default.Show(builder.BuildNotification());

The code works, but some time the notification will not show on desktop, and some time it will show on desktop, which is very confusing...

NOTE:Whether show on desktop or not, the notification will always listed in action center

Windows development | Windows App SDK
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.