Clear notifications working when testing macro but not when triggered live

mcjakenberry

New member
Hi all, I am trying to create a simple macro that when I receive an SMS from specific contacts, it clears the notifications of the Messaging app.
Looking at the logs, it looks like MacroDroid is actually triggering the macro when the SMS is received, but they are not actually cleared.
If I test the macro when I have a notification from the trigger contact, it clears the notification just fine.
I'm wondering if there is some kind of race condition of the notification not being displayed before the action is triggered? Maybe it's possible to add a delay before the trigger?
 

JA-Translator

Moderator
Looking at the logs, it looks like MacroDroid is actually triggering the macro when the SMS is received, but they are not actually cleared.

How about any constraints?
Do you have set any constraints?

If I test the macro when I have a notification from the trigger contact, it clears the notification just fine.

The test is with applying constraints?

Anyway, could you show us the screenshot or the macro?
 

mcjakenberry

New member
Sorry about that, I should have included that info to begin with.
Yes this macro is using constraints for time of day. During testing I set it to a 5ish hour window of the current time.
When I tested the trigger/action I just hit the overflow menu and test options from there, I assume that includes the constraints, but I also did see the macro logs triggering during the window as well.

And I'm on a pixel 7, Android 13
 

Attachments

  • Screenshot_20230623-100351~2.png
    Screenshot_20230623-100351~2.png
    90.4 KB · Views: 7
  • Screenshot_20230623-101756.png
    Screenshot_20230623-101756.png
    200.7 KB · Views: 7

JA-Translator

Moderator
It's a quite simple macro.
It looks fine without any problems.
Sorry I am not sure... 🤔

Shall we wait for any other advice from anyone else?

Maybe it's possible to add a delay before the trigger?

It's not possible to add a delay BEFORE the trigger,
but it's possible AFTER the trigger BEFORE the action.

How about that? Is it any good help?

You can find a Delay (Wait) action in the action list.
 

mcjakenberry

New member
It's a quite simple macro.
It looks fine without any problems.
Sorry I am not sure... 🤔

Shall we wait for any other advice from anyone else?



It's not possible to add a delay BEFORE the trigger,
but it's possible AFTER the trigger BEFORE the action.

How about that? Is it any good help?

You can find a Delay (Wait) action in the action list.
Sorry, that's what I actually meant, before the action - I'll play around with that and see if it will work!

And yes, I'm on the latest version - 5.34.10
 

JA-Translator

Moderator
Ah! Speaking of SMS, there is a thing that we need to pay attention.

Which SMS are you using?
It's hard to explain, but... let me try.

We usually have two SMS tools.
1. One is an original legacy one.
2. The other is SMS Application, like "Plus Message" App in Japan.

Screenshot_20230624_210755.png

We usually have to set either one as default.

For example of my case,
when I set Plus Message as default,
the SMS trigger doesn't work

because the Trigger is waiting for an incoming through the legacy SMS.
Therfore, I need to use App Trigger, instead.

The good point of the Plus Message is that I can receive SNS messages even through Wifi or Mobile network.

How about your case?
 

RSF

Well-known member
I'll play around with that and see if it will work!
If you're right about the race condition, which seems credible, adding a Wait action at the beginning of the macro should help.

If not, as an alternative, you could switch from using an SMS trigger, to using a Device Events > Notification > Notification Received trigger (specifying the Messages app you use, for which notifications to trigger on). That way you'd know the notification was posted by the time the macro executed...
Another benefit of using the Notification trigger is that the Messages app, when "Chat Mode" is enabled in its settings, doesn't seem to trigger the SMS trigger in MacroDroid correctly; I believe there's something about the chat version that bypasses the standard SMS logic.
 

mcjakenberry

New member
If you're right about the race condition, which seems credible, adding a Wait action at the beginning of the macro should help.

If not, as an alternative, you could switch from using an SMS trigger, to using a Device Events > Notification > Notification Received trigger (specifying the Messages app you use, for which notifications to trigger on). That way you'd know the notification was posted by the time the macro executed...
Another benefit of using the Notification trigger is that the Messages app, when "Chat Mode" is enabled in its settings, doesn't seem to trigger the SMS trigger in MacroDroid correctly; I believe there's something about the chat version that bypasses the standard SMS logic.
This is an interesting idea too, the only downside is I want it to trigger off specific contacts. I'm not sure if the text matching includes the contact name, but I can test that and see if it does.
 

RSF

Well-known member
I want it to trigger off specific contacts.
You won't be able to use Contact Groups, or find a contact from the Contacts app, as you can with the SMS Received trigger, but you can look at filter for certain text in the Notification Received trigger, and inspect the sender info via Notification-related variables ("Magic Text") in the body of the macro:
  • SMS Sender --> Notification Title
  • SMS Text --> Notification Text
 

mcjakenberry

New member
A bit of a late return to this, but I got a macro working for what I needed, it's pretty simple using the Notification Received trigger as RSF suggested:
Screenshot_20230909-234227.png
This actually worked for effectively silencing notifications from the specified contact name (using text filtering on sender, not actual contact) during the specified time window. Been working well and I only see the messages if i deliberately go to the main messages inbox which is good enough for my needs!

Thanks all for the help!
 
Top