Notification activation (NotificationCompleted) not always firing
Are there any specific configurations that need to be set for Notifications to activate on Windows (tap events)?
I have in my solution a "Desktop"-type project for both macOS and Windows, similar to the one in the Labs sample. And notification work just fine and I can get the NotificationCompleted event to fire on both platforms. when tapping actions.
But, I'm also trying out with platform-specific projects, in order to separate configurations, one for mac and one for windows. The mac one works just fine, but the Windows only project does not work when tapping the notification. The NotificationCompleted event simply does not fire. So I must be missing something here.
TargetFramework for the windows-only project is just net9.0. But I do remember from an earlier WinForms project that I needed to target a specific version of windows in order to register for notification tap events, like net9.0-windows10.0.19041.0, but that didn't help either.
Windows notifications require the app be packaged.
@emmauss Thanks for the reply, but not sure I follow.
In my own solution, the cross-platform project that targets both net9.0 and net9.0-macos, runs and activates the notifications properly without any packaging. But the project that only targets net9.0, fails to activate tap events only (notifications do pop up).
I do see in the sample repo a project Avalonia.Labs.Catalog.Desktop.Packaged, but it does not seem to be part of the solution itself... How does that really work?
Ok, I seem to have it working properly now. There must have been some type of conflict within my solution. It did not like that I had several projects targeting multiple/different platforms. So I did a full cleanup:
- Removed the cross-platform project (targeting both
net9.0andnet9.0-macos) - The mac-only project now targets only
net9.0-macos(I have it unloaded when working on Windows) - The windows-only project now targets only
net9.0(I have it unloaded when working on macOS)
So it seems like it's either or project setup. Either keep the single cross-platform project targeting both platforms and deal with config and signing there. Or split them up, one for each targeting platform.
Now notification tap event fires properly on both macos and windows :)