Changes

no edit summary
Line 1: Line 1: −
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
<pre class="header-style">The Intent Received trigger fires when an intent with the specified action is broadcast by another application. This allows MacroDroid to respond to system events and inter-app communication through Android's intent mechanism. You can pattern match against extra parameter values and store these values into variables.</pre>
This trigger will fire when an intent with the specified action is fired by another application.
     −
You can also pattern match against one or more extra parameter values, as well as store these values into variables.
+
''' Options '''
</pre>
+
 
 +
* '''Action''': The intent action string to listen for (e.g., "android.intent.action.BATTERY_LOW" or a custom action from another app).
 +
 
 +
* '''Extras''': Optionally configure one or more extra parameters to match:
 +
** '''Parameter Name''': The name/key of the intent extra to check
 +
** '''Value''': The pattern to match against (supports wildcards)
 +
** '''Variable''': Optionally store the extra's value into a string variable with optional dictionary keys
 +
 
 +
* '''Enable Regex''': When enabled, value patterns are treated as regular expressions instead of wildcard patterns.
 +
 
 +
''' Examples '''
 +
 
 +
''Example 1: Respond to Custom App Intent''
 +
  <pre class="trigger-style">Triggers
 +
 
 +
Intent Received - com.example.app.CUSTOM_EVENT</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Popup Message - Custom event received!</pre>
 +
 
 +
Triggers when another app broadcasts the custom intent "com.example.app.CUSTOM_EVENT".
 +
 
 +
''Example 2: Capture Intent Extra into Variable''
 +
  <pre class="trigger-style">Triggers
 +
 
 +
Intent Received - com.example.app.DATA_UPDATE
 +
  Extra: data_value = * (save to: received_data)</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Popup Message - Received: {v=received_data}</pre>
 +
 
 +
Captures the "data_value" extra from the intent and stores it in a variable.
 +
 
 +
''' Notes '''
 +
 
 +
* Intent actions are case-sensitive strings.
 +
* Common system intent actions can be found in Android documentation.
 +
* The wildcard character (*) can be used in value patterns to match any content.
 +
* Multiple extra parameters can be configured, each with their own pattern and variable.
 +
* Each intent action is registered only once, even if multiple macros use the same action - MacroDroid efficiently shares the broadcast receiver.
 +
* Supports both local and global variables for storing extra values.
 +
* Dictionary keys can be specified when saving to array/dictionary variables.
 +
 
 +
''' Common Intent Actions '''
 +
 
 +
* <code>android.intent.action.BATTERY_LOW</code> - Battery is low
 +
* <code>android.intent.action.BATTERY_OKAY</code> - Battery is okay
 +
* <code>android.intent.action.POWER_CONNECTED</code> - Power connected
 +
* <code>android.intent.action.POWER_DISCONNECTED</code> - Power disconnected
 +
* <code>android.provider.Telephony.SMS_RECEIVED</code> - SMS received
 +
* <code>android.intent.action.PACKAGE_ADDED</code> - App installed
 +
 
 +
''' See Also '''
 +
 
 +
* [[Action:_Send_Intent|Send Intent Action]]