Click on Windows Notification triggers EventType.onDismissedTimedOut
When I click on the notification I expect the onActivate event but get onDismissedTimedOut
Flutter doctor
windows_notification:1.2.0
[!] Flutter (Channel [user-branch], 3.22.0, on Microsoft Windows [Version 10.0.22631.3593])
! Flutter version 3.22.0 on channel [user-branch] at D:\FlutterAppDevelop\flutter
Currently on an unknown channel. Run flutter channel to switch to an official channel.
If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
! Upstream repository unknown source is not a standard remote.
Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
• Framework revision 5dcb86f68f (13 days ago), 2024-05-09 07:39:20 -0500
• Engine revision f6344b75dc
• Dart version 3.4.0
• DevTools version 2.34.3
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
[√] Windows Version (Installed version of Windows is version 10 or higher)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc4)
• Android SDK at D:\AndroidSDK
• Platform android-34, build-tools 34.0.0-rc4
• Java binary at: C:\Program Files (x86)\Common Files\Oracle\Java\java8path\java.exe
X Could not determine java version
X Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.9.7) • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community • Visual Studio Community 2022 version 17.9.34902.65 • Windows 10 SDK version 10.0.22621.0
[!] Android Studio (not installed) • Android Studio not found; download from https://developer.android.com/studio/index.html (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
[√] VS Code (version 1.89.1) • VS Code at C:\Users\develop\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.88.0
[√] Connected device (3 available) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22631.3593] • Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.208 • Edge (web) • edge • web-javascript • Microsoft Edge 125.0.2535.51
[√] Network resources • All expected network resources are available
When I click on the notification I expect the onActivate event but get onDismissedTimedOut
Flutter doctor
windows_notification:1.2.0
[!] Flutter (Channel [user-branch], 3.22.0, on Microsoft Windows [Version 10.0.22631.3593]) ! Flutter version 3.22.0 on channel [user-branch] at D:\FlutterAppDevelop\flutter Currently on an unknown channel. Run
flutter channelto switch to an official channel. If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install. ! Upstream repository unknown source is not a standard remote. Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error. • Framework revision 5dcb86f68f (13 days ago), 2024-05-09 07:39:20 -0500 • Engine revision f6344b75dc • Dart version 3.4.0 • DevTools version 2.34.3 • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.[√] Windows Version (Installed version of Windows is version 10 or higher)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc4) • Android SDK at D:\AndroidSDK • Platform android-34, build-tools 34.0.0-rc4 • Java binary at: C:\Program Files (x86)\Common Files\Oracle\Java\java8path\java.exe X Could not determine java version X Android license status unknown. Run
flutter doctor --android-licensesto accept the SDK licenses. See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.[√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.9.7) • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community • Visual Studio Community 2022 version 17.9.34902.65 • Windows 10 SDK version 10.0.22621.0
[!] Android Studio (not installed) • Android Studio not found; download from https://developer.android.com/studio/index.html (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
[√] VS Code (version 1.89.1) • VS Code at C:\Users\develop\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.88.0
[√] Connected device (3 available) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22631.3593] • Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.208 • Edge (web) • edge • web-javascript • Microsoft Edge 125.0.2535.51
[√] Network resources • All expected network resources are available
hi, In this topic we have information about ToastDismissalReason
ApplicationHidden 1
The app explicitly hid the toast notification by calling the [ToastNotifier.hide](https://learn.microsoft.com/en-us/uwp/api/windows.ui.notifications.toastnotifier.hide?view=winrt-22621#windows-ui-notifications-toastnotifier-hide(windows-ui-notifications-toastnotification)) method.
TimedOut 2
The toast notification had been shown for the maximum allowed time and was faded out. The maximum time to show a toast notification is 7 seconds except in the case of long-duration toasts, in which case it is 25 seconds.
UserCanceled 0
The user dismissed the toast notification.
If you want to trigger the onActivate event, I recommend using a custom template with a button.
I don't think this is a problem, if you think otherwise, please give me some information on how to do it correctly so I can check.
Hi, thanks for the documentation
My problem is that onDismissedTimedOut fires when I click on the notification or when the notification is timed out.
I have a method that opens a page when a notification is clicked and it also fires when the notification is hidden, which I would like to avoid
Show notification code
if (Platform.isWindows) {
final message = NotificationMessage.fromPluginTemplate(
(_id++).toString(),
title,
body,
launch: payload,
group: 'App',
);
_windowsNotification.showNotificationPluginTemplate(message);
}
Open page code
if (Platform.isWindows) {
_windowsNotification = WindowsNotification(
applicationId: AppNameConstants.appName,
);
_windowsNotification.initNotificationCallBack((details) async {
// EventType.onDismissedTimedOut fires on user click or when notification hidden
if (details.eventType == EventType.onDismissedTimedOut && details.message.launch?.isNotEmpty == true) {
Future.delayed(const Duration(milliseconds: 200), () async {
await windowManager.setAlwaysOnTop(true);
await windowManager.focus().then((value) async {
goRouter.go(details.message.launch!);
_windowsNotification.removeNotificationId(details.message.id, details.message.group ?? '');
await windowManager.setAlwaysOnTop(false);
});
});
}
});
}
@NikitaPnch Hi, have you found a solution for this?
@NikitaPnch Hi, have you found a solution for this?
Yes, i use different package local_notifier, it works for me pretty well
I have the same issue, it's ok in debug mode, but if i build a msix file then open it, click the action button do noting.