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

Clicking on notification action button does not dismiss notification on android terminated state #1991

Closed
Cha195 opened this issue May 12, 2023 · 6 comments · Fixed by #2000

Comments

@Cha195
Copy link

Cha195 commented May 12, 2023

Hi team. Thanks for the plugin. I'm facing an issue with notification actions.

When a user clicks on the notification action, while the app is in terminated state (cleared from recent apps), the notification is not dismissed and it stays.
The notification sent is a data message so we don't get an FCM notification as well (which does not show the action buttons).
Refer to the recording below.

Uploading Screen_Recording_20230512_112839_Pocketpills (Stg).mp4…

@MaikuB
Copy link
Owner

MaikuB commented May 12, 2023

I can't see the video and if you'd like to report a bug, then this should be done via the bug report and include a link to a repo of a minimal app that can reproduce the issue. This is best done via a fork of the repo and modify the example app to demonstrate this. In saying that, the example app shows that this is possible so I suggest you take a closer look at it and cross-reference it with what you've done. My guess is you've set https://pub.dev/documentation/flutter_local_notifications/latest/flutter_local_notifications/AndroidNotificationAction/cancelNotification.html to false. Here's a recording I took of the example app where you can see the notification is dismissed/cancelled after tapping on an action

device-2023-05-12-215835.mp4

@Cha195
Copy link
Author

Cha195 commented May 13, 2023

Hi @MaikuB thank you for the response. But the notification that you show in the recording is a foreground notification which you click after terminating the app. The scenario I mentioned in the issue was receiving the notification when the app is terminated.

@MaikuB
Copy link
Owner

MaikuB commented May 13, 2023

The state of the app when the notification appears has no impact on this. I could change the example to schedule notification with actions so that it appears after the app is terminated and the result is the same.

device-2023-05-13-141721.mp4

Note that you still need to provide a evidence of the issue with a link to repo hosting a minimal app that can reproduce this. Unless you're going to do this then this won't be looked into further and the issue will be closed.

@Cha195
Copy link
Author

Cha195 commented May 14, 2023

Hi @MaikuB, as requested I have forked the repo made changes to reproduce the issue.
Link: https://github.com/Cha195/flutter_local_notifications

The change was to set showUserInterface parameter to true in the AndroidNotificationAction as shown below. This opens the app when the user clicks on the Notification Action Button but does not dismiss the notification when it is received in the terminated state in android.

image
Screen_Recording_20230514_122656.mp4

@MaikuB
Copy link
Owner

MaikuB commented May 16, 2023

Thanks for providing this as this helped reproduce the issue. I have a fix in https://github.com/MaikuB/flutter_local_notifications/tree/fix-notification-action-terminated. Could you help verify that this solves the issue? You could also try using that branch with your app temporarily as well by following steps mentioned in https://dart.dev/tools/pub/dependencies#git-packages. Once you've confirmed this solves the issue, I'll have this merged in and released as a patch update

@Cha195
Copy link
Author

Cha195 commented May 17, 2023

Hi @MaikuB thanks for the swift action! I tested the code in two my own app and the example app and yes the changes work. Thanks for your effort! The recording of the new app is attached for reference.
Cheers

Screen_Recording_20230517_173834.mp4

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