FrameXX
Well-known member
I am sure everyone knows "Macro Run" action or use variables to trigger another macros, but I think sending an Intent broadcast is another good way how to communicate inside MacroDroid that is not much used.
Using intents is not good for storing values like variables do, but rather for triggering events. Unlike with "Macro Run" action you can recognize that intent was fired and not some other trigger.
You can also trigger with some extra data by adding an extras into intent action and than receiving them.
For example I can run a Macro that will do something and than it will need to decode some text. But the text will be decoded by some another macro. I can use send intent action to fire that macro and also send extra with text I want to decode. Macro does it's work and than sends back intent with decoded text. My macro used wait until trigger and now it continues with text decoded. No global variables needed! What a Magic!
So why not use Variables instead? They can do all of this.
In case of just triggering something and not storing values, I don't see a reason to use variables and messing up your global variable list even more. It's lot simpler to use intents in this scenario.
HOW TO SEND A BROADCAST INTENT
Target: Broadcast
Action: You can name it as you want, just don't use spaces and other special characters (MyIntentBroadcast)
Package: You don't need to write package, but I recommend you to do it, otherwise all apps will be able to see the broadcast (com.arlosoft.macrodroid)
Extras: Name your extras as you want and add some variable as a value. (MyVariable; [lv=MyVariable])
HOW TO RECEIVE A BROADCAST INTENT
Action: Name of action you sent (MyIntentBroadcast)
Extra name: Name of your extra (MyVariable)
Extra value: Value to match. You can use * all the time, which will match any text. But for example *5G* will only match if text contains 5G. If extra value will not match, trigger with intent will not fire at all.
HINT: If you receive intent with extra it's possible, that it will receive and fire many times in 1 time. To prevent this kind of spamming add "This macro not invoke for 1 second" constraint for intent trigger. I think this is a MacroDroid Bug .
Using intents is not good for storing values like variables do, but rather for triggering events. Unlike with "Macro Run" action you can recognize that intent was fired and not some other trigger.
You can also trigger with some extra data by adding an extras into intent action and than receiving them.
For example I can run a Macro that will do something and than it will need to decode some text. But the text will be decoded by some another macro. I can use send intent action to fire that macro and also send extra with text I want to decode. Macro does it's work and than sends back intent with decoded text. My macro used wait until trigger and now it continues with text decoded. No global variables needed! What a Magic!
So why not use Variables instead? They can do all of this.
In case of just triggering something and not storing values, I don't see a reason to use variables and messing up your global variable list even more. It's lot simpler to use intents in this scenario.
HOW TO SEND A BROADCAST INTENT
Target: Broadcast
Action: You can name it as you want, just don't use spaces and other special characters (MyIntentBroadcast)
Package: You don't need to write package, but I recommend you to do it, otherwise all apps will be able to see the broadcast (com.arlosoft.macrodroid)
Extras: Name your extras as you want and add some variable as a value. (MyVariable; [lv=MyVariable])
HOW TO RECEIVE A BROADCAST INTENT
Action: Name of action you sent (MyIntentBroadcast)
Extra name: Name of your extra (MyVariable)
Extra value: Value to match. You can use * all the time, which will match any text. But for example *5G* will only match if text contains 5G. If extra value will not match, trigger with intent will not fire at all.
HINT: If you receive intent with extra it's possible, that it will receive and fire many times in 1 time. To prevent this kind of spamming add "This macro not invoke for 1 second" constraint for intent trigger. I think this is a MacroDroid Bug .
Last edited: