-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Description
Originally this problem was reported via #24788 (comment), but the post is blocked there, so I am creating a new one here with more detailed information, which should make it clear that this is a MAUI problem after all.
How to create local notifications in Windows is described in detail in https://learn.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/send-local-toast?tabs=uwp.
Unfortunately this description does not work with MAUI Windows, the OnActivated method solves CS0115 in App.xaml.cs. Probably because of public partial class App : MauiWinUIApplication
.
Current situation: You can easily store a local notification in MAUI Windows, but you cannot read a parameter from Windows (would be provided via OnActivated). As a result, no action can be taken when the user clicks on the notification and Windows opens the app. This is particularly annoying for apps that are supposed to display certain appointments, because the user is informed that an appointment is pending, but has to search for this appointment in the list himself after opening the app (which is of course unacceptable in terms of user-friendliness). If it were possible to read the information (e.g. ID) from Windows via arguments in the OnActivated method as provided in the example, then the appointment could be found automatically when the app is opened and displayed to the user (which would also be an expected behavior of the app for every Temrin app).
What is very frustrating for me is the fact that I was able to implement the local notification in MAUI for the iOS and Android platforms in 30 minutes without any problems. If you want to do it even faster, you can also use Plugin.LocalNotification Nuget.
I have been looking into this problem with the MAUI Windows local notification for noths now without anyone giving me an answer to my question at microsoft.
I have also asked CommunityToolkit - Maui if the toast function can be set correctly there, because at the moment it is an instant message that can currently be generated in dozens of different ways with any UI library (FluentUI, Ant, radzen). What the CommunityToolkit is missing is this time-triggered notification, but I have had no success there either (see CommunityToolkit/Maui#2326)
I also asked MAUI Samples recently, see dotnet/maui-samples#560 , but unfortunately also without success.
Steps to Reproduce
I hope someone from MAUI team will comment on this topic, because as I said in some posts, MAUI should not be designed primarily for iOS and Android. There are still many developers who continue to program only for Windows platforms (this was also the case for me until MAUI was released) and if you want to win them on board, you have to be able to implement the most important things in MAUI that you can do with WPF (or winforms), for example.
Regards
pc
Link to public reproduction project repository
https://github.com/true-perfect-code/LocalNotificationWindows_Test2
Version with bug
9.0.22 SR2.2
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
No response
Affected platforms
Windows
Affected platform versions
Windows 11
Did you find any workaround?
No response