2 messages received at once

Hi,

I wrote a simple macro that reads the sender's name and the content of a SMS message when I'm in my car.
It worked very well on my Oneplus 6T until Android 11 was installed on it. At that moment, each time I got a message the macro was invoked twice. And in the log i'd see 2 SMS received (at the same time or with 1s between them). And this was when using the Google message app. If I used the built-in Oneplus message app, it would be triggered only once BUT couldn't read the name of the sender (indeed, "notification title" reports the sender if using google app, but it reports juste the words "1 new message" if using Oneplus app).
Anyway I bought a Oneplus 8T recently (Android 11) and I have the same problem (the built-in messaging app is the one from Google).

So : is there a way not to have a macro triggered twice when receiving 1 message ?

Thank you !
 

Pseudocyclic

Well-known member
You could create two string variables, something like newsms and oldsms, and when a message arrives, save it to newsms. Then compare newsms and oldsms, and only read the message out loud if they are different. And finally, save the contents of newsms to oldsms.
 
I tried the 2 strings idea but the problem is the macro is triggered at the same time and actions are done twice simultaneously...
I also tried to make 2 macros : one which reads the content and deactivate itself, and one which activates this first macro. But it only worked half of the time, because sometimes the "reading macro" is done twice at the same time.
 

Pseudocyclic

Well-known member
Maybe this approach will be quick enough:
 

Attachments

  • Screenshot_20211006-000101_MacroDroid.jpg
    Screenshot_20211006-000101_MacroDroid.jpg
    191.1 KB · Views: 33
I tried but I still have the same problem...

On the log you can see that the macro is triggered twice, and the text is read twice as well.
(If i set the variable definition at the end of the macro, like you did, it's the same problem. And i used a local var instead of a global, but i suppose it's not important.)

Sans titre.png
 

tanutanu

Well-known member
I tried but I still have the same problem...

On the log you can see that the macro is triggered twice, and the text is read twice as well.
(If i set the variable definition at the end of the macro, like you did, it's the same problem. And i used a local var instead of a global, but i suppose it's not important.)

To avoid TTS twice, simply add cancel action with variable message = [not_title][notification] constraint on the top of your Actions.
 

tanutanu

Well-known member
Just add a constraint at the bottom, macro invoked/not invoked
I don't think it works expected. invoked constraint returns always true and not invoked returns false. The argument is longer or shorter. Invoke for 1 sec. constraint on constraint (green) field is effective though.
 

420

Active member
tried but I still have the same problem...

On the log you can see that the macro is triggered twice, and the text is read twice as well.
(If i set the variable definition at the end of the macro, like you did, it's the same problem. And i used a local var instead of a global, but i suppose it's not important.)

View attachment 1128
I think the issue with this is that you have it write both the notification title and the text to that variable. (without a blank space inbetween even)

So say the notification title is "notification title" and the notification message is "notification message".

Then your variable will say "notification titlenotification message" so the constraint on your speak text action is correct, there is no notification present literally containing "notification titlenotification message"

I really don't think that this will ever work.. because the notification is always present when that trigger fires...

I would suggest you try this instead;
 

Attachments

  • Screenshot_20211007-123819.png
    Screenshot_20211007-123819.png
    158.4 KB · Views: 27
Last edited:

willfrench

New member
Set "Settings"> "Advanced Settings"> "Apps" and remove "Google Messages". If you use the Oneplus built-in messaging app (or any other built-in app that receives notifications through "Google"), set "Enable Gmail" or "Enable Messages" in both apps. Reconnect your devices and see if the problem is resolved. I can't help you any other way. It's so weird that there hasn't been an app that sets up macros on its own for a long time. You can also see how it all works from clerk.chat. There seems to be a similar function there
 
Last edited:
Top