Email notification: Receiving two notifications at same time - email message text not updated

LittleAlf

New member
I use a macro to send an email message every time I get a notification from a certain app with a specified title. If now two notifications are triggered by this app at (almost) the same time the message body is not updated for the second message! That means, that I get two identical emails.

This happens only, if the two notifications are triggered very shortly one after the other.

The following macro settings for 'Send Email':
  • Message text: [not_text-big]
  • 'Block next actions until complete' = unticked
This is what I could gather from the system log:
29-06-23 13:53:21.509 - T: Notification Received (Banking) Kartenzahlung
29-06-23 13:53:21.510 - Invoking Macro: Kartenzahlung Kartenzahlung
29-06-23 13:53:21.536 - A: Set Variable (CurrNotTitle: Umsatz gebucht) Kartenzahlung
29-06-23 13:53:21.543 - A: If (CurrNotTitle = Umsatz gebucht) Kartenzahlung
29-06-23 13:53:21.548 - A: Set Variable (CurrentDate: 2023-06-29 / 13:53:21) Kartenzahlung
29-06-23 13:53:21.553 - Updated value from 2023-06-28 / 17:07:36 to 2023-06-29 / 13:53:21 Kartenzahlung
29-06-23 13:53:21.560 - A: Send Email: 2023-06-29 / 13:53:21 - Umsatz gebucht / -10,28 EUR: VISA EDEKA SAGT DANK Kartenzahlung
29-06-23 13:53:21.562 - T: Notification Received (Banking) Kartenzahlung
29-06-23 13:53:21.563 - Invoking Macro: Kartenzahlung Kartenzahlung
29-06-23 13:53:21.563 - A: Set Variable (CurrNotTitle: Umsatz gebucht) Kartenzahlung
29-06-23 13:53:21.564 - A: If (CurrNotTitle = Umsatz gebucht) Kartenzahlung
29-06-23 13:53:21.565 - A: Set Variable (CurrentDate: 2023-06-29 / 13:53:21) Kartenzahlung
29-06-23 13:53:21.567 - A: Send Email: 2023-06-29 / 13:53:21 - Umsatz gebucht / -10,28 EUR: VISA EDEKA SAGT DANK Kartenzahlung
29-06-23 13:53:32.437 - Email sent to: uwe.maas@gmx.net Kartenzahlung
29-06-23 13:53:32.454 - Email sent to: uwe.maas@gmx.net Kartenzahlung

How can I make sure that the message on the second email is properly updated too?

Any help is very much appreciated.
 

Endercraft

Moderator (& bug finder :D)
I do remember an issue with notification trigger firing twice, however the issue you are describing here is not something I have heard of... Are you sure you are receiving 2 notifications and not just 1 ?

If that's the case please report a bug from MacroDroid (in the troubleshooting section) and describe the issue precisely.
 

Qarboz

Well-known member
I use a macro to send an email message every time I get a notification from a certain app with a specified title. If now two notifications are triggered by this app at (almost) the same time the message body is not updated for the second message! That means, that I get two identical emails.

This happens only, if the two notifications are triggered very shortly one after the other.

The following macro settings for 'Send Email':
  • Message text: [not_text-big]
  • 'Block next actions until complete' = unticked
This is what I could gather from the system log:
29-06-23 13:53:21.509 - T: Notification Received (Banking) Kartenzahlung
29-06-23 13:53:21.510 - Invoking Macro: Kartenzahlung Kartenzahlung
29-06-23 13:53:21.536 - A: Set Variable (CurrNotTitle: Umsatz gebucht) Kartenzahlung
29-06-23 13:53:21.543 - A: If (CurrNotTitle = Umsatz gebucht) Kartenzahlung
29-06-23 13:53:21.548 - A: Set Variable (CurrentDate: 2023-06-29 / 13:53:21) Kartenzahlung
29-06-23 13:53:21.553 - Updated value from 2023-06-28 / 17:07:36 to 2023-06-29 / 13:53:21 Kartenzahlung
29-06-23 13:53:21.560 - A: Send Email: 2023-06-29 / 13:53:21 - Umsatz gebucht / -10,28 EUR: VISA EDEKA SAGT DANK Kartenzahlung
29-06-23 13:53:21.562 - T: Notification Received (Banking) Kartenzahlung
29-06-23 13:53:21.563 - Invoking Macro: Kartenzahlung Kartenzahlung
29-06-23 13:53:21.563 - A: Set Variable (CurrNotTitle: Umsatz gebucht) Kartenzahlung
29-06-23 13:53:21.564 - A: If (CurrNotTitle = Umsatz gebucht) Kartenzahlung
29-06-23 13:53:21.565 - A: Set Variable (CurrentDate: 2023-06-29 / 13:53:21) Kartenzahlung
29-06-23 13:53:21.567 - A: Send Email: 2023-06-29 / 13:53:21 - Umsatz gebucht / -10,28 EUR: VISA EDEKA SAGT DANK Kartenzahlung
29-06-23 13:53:32.437 - Email sent to: uwe.maas@gmx.net Kartenzahlung
29-06-23 13:53:32.454 - Email sent to: uwe.maas@gmx.net Kartenzahlung

How can I make sure that the message on the second email is properly updated too?

Any help is very much appreciated.
You can try to put the actions in an action block and call it with the same trigger, and as parameters the subject and text of the email
 

MacroDroidDev

Administrator
Staff member
Do you have any evidence that the second update contains different text. It is not uncommon for apps to cause multiple updates/events for a notification with the same content, so it may just be a case that the text is identical.
 

LittleAlf

New member
@Endercraft , @MacroDroidDev :
I can confirm that the two notifications contain definitely different texts. I observed the corresponding notifications as well as the corresponding actions in the app.

As can be seen from the log: The two notifications are triggered just 53 milliseconds apart!

I would like to try the 'Block next actions until complete' setting, but I fear that MacroDroid will then miss out the second notification completely.

I believe that the key is in the line 'Updated value from ...'. This line shows up for the first notification only. Since the time stamp for the second notification is identical (if you look until seconds only, and not milliseconds), reading the message text with [not_text-big] is not executed, since same time stamp is seen as same notification.

Many thanks for your help.
 

LittleAlf

New member
You can try to put the actions in an action block and call it with the same trigger, and as parameters the subject and text of the email
That is also a good idea. I have not worked with an action block yet, but I will look into it.

Thanks. :)
 

Dimlos

Well-known member
I believe this phenomenon is a limitation of the notification trigger.
I have prepared a macro that displays notifications and saves them to an array, but notifications displayed for a very short period of time cannot be retrieved correctly.

As you can see from the screenshot, the notifications are displayed correctly, but retrieving them seems to be impossible. If the number of times the notification is displayed is reduced, it can be retrieved correctly.

I think this limitation is unlikely to be a real problem since it is milliseconds, but I can't think of a workaround at the moment.
 

Attachments

  • send_notification.macro
    3.4 KB · Views: 1
  • record_notification.macro
    5.7 KB · Views: 0
  • notification.jpg
    notification.jpg
    373.3 KB · Views: 6
  • result.jpg
    result.jpg
    291 KB · Views: 6

alexhee

Member
Having the same issue with multiple trigger even I put Not Involved Recently contraints for the trigger.

Funny is it happened randomly, may be 10 times there will be 1-2 times this multiple trigger issue will happen. Not sure whether this is a bug or else.
 

MacroDroidDev

Administrator
Staff member
If anyone finds a way to recreate this reliably without needing some specific app/account etc. then please use report a bug in troubleshooting. It's perfectly possible there is some subtle bug here but I've look over the code and can't spot anything and I have never made it happen myself after various tests.
 

Endercraft

Moderator (& bug finder :D)
If anyone finds a way to recreate this reliably without needing some specific app/account etc. then please use report a bug in troubleshooting. It's perfectly possible there is some subtle bug here but I've look over the code and can't spot anything and I have never made it happen myself after various tests.
Done
 

Endercraft

Moderator (& bug finder :D)
Bug report :



I found a way to reproduce easily even if you may have to try multiple times.

I've observed 2 behaviors :

1. The notification trigger thinks notification A is notification B and notification B is still notification B.

Screenshot_2023-07-17-16-48-17-936-edit_com.arlosoft.macrodroid.jpg

2. Just like the original problem, notification A remains notification A but notification B is now notification A.

Screenshot_2023-07-17-16-50-49-527-edit_com.arlosoft.macrodroid.jpg

The rest of the time the action were executed too far apart (in milliseconds) to reproduce that behavior. That's why you need to try multiple times.

In the screenshot you can see these behaviors (look at the milliseconds between notification actions).
 

Attachments

  • Bug.macro
    5.3 KB · Views: 1

alexhee

Member
Thanks @Endercraft.

I've found the problem when two notifications come in at roughly the same time and I have a fix. This will go into the V5.36 release so hopefully this should solve the issues described above.
@MacroDroidDev Please take a look for the "Screen Content" trigger as well, because it's having the same issue as "Notification Received" triggers. Sometimes, it may trigger twice or more in less than 100ms even not involved contraints has been setup.
 

Endercraft

Moderator (& bug finder :D)
@MacroDroidDev Please take a look for the "Screen Content" trigger as well, because it's having the same issue as "Notification Received" triggers. Sometimes, it may trigger twice or more in less than 100ms even not involved contraints has been setup.
I wonder if that's because the text you're searching for is present multiple times on the screen.
 

alexhee

Member
I wonder if that's because the text you're searching for is present multiple times on the screen.
No. Only one text is present on the screen but the trigger will detect it as twice or more. However, it only happened more frequent when read screen update rate set to 0.25 or 0.1, if 0.5 above then it may working fine at most of the times. For example,

screen update rate = 0.1, 5 out of 10 times it triggered twice or more.
screen update rate = 0.25, 3 out of 10 times it triggered twice or more.
screen update rate = 0.5, 2 out of 10 times it triggered twice or more.
 
Top