Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Windows Local Notifications docs #2744

Merged
merged 2 commits into from
Jan 22, 2025
Merged

Conversation

jfversluis
Copy link
Member

@jfversluis jfversluis commented Jan 18, 2025

Added a note that scheduled notifications are not supported at this time.

A feature request has been opened here: microsoft/WindowsAppSDK#5050

Fixes #2743


Internal previews

📄 File 🔗 Preview link
docs/platform-integration/local-notifications.md docs/platform-integration/local-notifications

@true-perfect-code
Copy link

@jfversluis

You should write in the documentation that there is a way to implement the local scheduled notification in MAUI via UWP.Notifications Nuget until a WinAppSDK support is complete for local notification.

You can use existing instructions from UWP.Notifications implementation, but there are 2 adjustments:

  1. in App.xaml.cs under public App() => see: https://github.com/true-perfect-code/MauiApp1_UWPNotifications/blob/master/MauiApp1_UWPNotifications/Platforms/Windows/App.xaml.cs
  2. when calling the notification => see: https://github.com/true-perfect-code/MauiApp1_UWPNotifications/blob/master/MauiApp1_UWPNotifications/Components/Pages/Home.razor

As a reminder:
Local scheduled MAUI Windows notification cannot be implemented with WinAppSDK because the method for it is missing. When using UWP.Notifications, the problem was to get the Windows start arguments, because there is no OnActivated event in MAUI anymore (was replaced by OnLaunched and OnLaunched does not get Windows parameters from the notification).

If someone needs scheduled notifications for MAUI, then you have to use UWP.Notifications Nuget (as of January 2025) and there is a workaround from @whiskhub to get the ID sent by Windows. However, we all hope that the WinAppSDK team will implement a complete migration from UWP.Notification to windowsAppSDK so that WinAppSDK can be used for local notification in MAUI (as is also planned by Microsoft)

You can find a working example here: https://github.com/true-perfect-code/MauiApp1_UWPNotifications

pc

@davidbritch davidbritch merged commit 8c9e898 into main Jan 22, 2025
4 checks passed
@davidbritch davidbritch deleted the jfversluis-patch-1 branch January 22, 2025 11:28
@@ -453,6 +453,9 @@ Local notifications in the Windows App SDK are messages that your app can send t

For information about local notifications on Windows, including implementation details for packaged and unpackaged apps, see [App notifications overview](/windows/apps/windows-app-sdk/notifications/app-notifications/).

> [!WARNING]
> Currently, scheduled notifications aren't supported in the Windows App SDK. For more information, see [Feature Request: Schedule toast notifications](https://github.com/microsoft/WindowsAppSDK/issues/5050$0).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not $0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scheduled local notification in MAUI windows is not possible!
4 participants