"mobile_app_notification_cleared" not fired when notification clicked
See original GitHub issueHome Assistant Android version: beta-2300-f33743dc-full
Android version: 12
Phone model: Samsung Galaxy S10+
Home Assistant version: 2022.5.4
Last working Home Assistant release (if known):
Description of problem: When a notification is manually cleared, the mobile_app_notification_cleared trigger fires. When a notification is clicked, the corresponding clickAction is executed (or HomeAssistant is started if no action is set) and the notification is closed. However, the notification is then only closed, but the trigger “mobile_app_notification_cleared” is not triggered. Therefore, the “wait_for_trigger” event is also not triggered in a script, which can lead to problems/overlaps with a trigger with a timeout.
Traceback (if applicable, to get the logs you may refer to: https://companion.home-assistant.io/docs/troubleshooting/faqs/#android-crash-logs):
Screenshot of problem:
Additional information:
Issue Analytics
- State:
- Created a year ago
- Comments:8 (5 by maintainers)
I currently do not have the time to test it by myself, but I think it should work to call the delete Intent
in
createOpenUriPendingIntent
.Another solution would be to handle the clickAction itself as an event with a custom identifier.
I found this idea of sending the intent to a
Service
(ok, it was loooong time ago): https://stackoverflow.com/questions/25830673/android-dont-open-app-after-performing-notification-on-click-actionIf it’s something that could still be done to prevent the app to open but capture the intent, the event identifier in the
clickAction
could be sent through the service, or at least something related to the current notification.In this is something possible, I would avoid using sending a fake “Notification Cleared” event through the service. In my opinion, clicking the notification is not clearing/dismissing it. There is an intent to interact with the notification. That’s why I’m not sure that fire “Notification Cleared” would be the best idea to capture this user intent.