Action - Send Broadcast

The action Send Broadcast send a broadcast using the specified intent. Please also see the documentation of the Android Intent class.
Tip: Some broadcast receivers require special permissions to be launched. Check the log after testing the action when the broadcast receiver fails.

 

Examples:
  • Control an app that exposes its actions using a broadcast receiver.
Settings
Action
The action to use in the intent. Variables are supported.
Category List
The list of categories as a comma separated list to add to the intent. Variables are supported.
Data URI
The data URI to set on the intent. Variables are supported.
Mime Type
The mime type to set on the intent. Variables are supported.
Package Name
The specific package to launch. Variables are supported.
Class Name
The specific class to launch. Variables are supported.
Flag List
The flags to add to the intent.
Extras
A script used to add an unlimited number of extras to the intent.

Additionally to the regular built in functions of Automagic also the following functions are available to add the extras to the intent:
  • putString(key, value)
  • putBoolean(key, value)
  • putFloat(key, value)
  • putDouble(key, value)
  • putByte(key, value)
  • putShort(key, value)
  • putChar(key, value)
  • putInt(key, value)
  • putLong(key, value)
  • putUri(key, value)
  • putBooleanArray(key, value)
  • putByteArray(key, value)
  • putIntArray(key, value)
  • putIntegerArrayList(key, value)
  • putLongArray(key, value)
  • putFloatArray(key, value)
  • putDoubleArray(key, value)
  • putShortArray(key, value)
  • putCharArray(key, value)
  • putStringArray(key, value)
  • putStringArrayList(key, value)
  • putUriArray(key, value)
  • putUriArrayList(key, value)

Example:
putString("key1", "Hello");
putBoolean("key2", true);
putDouble("key3", 1.23);
putInt("key4", 42);
putInt("key5", a+4*b);
See action Script for a description of the scripting language.
Send ordered broadcast
Whether Automagic should send an ordered broadcast which allows a broadcast receiver to provide a result to Automagic.
Access Result Extras
Script to access the returned extras.
Following functions are supported:
  • getString(String key)
  • getChar(String key, String defaultValue)
  • getBoolean(String key, Boolean defaultValue)
  • getFloat(String key, Number defaultValue)
  • getDouble(String key, Number defaultValue)
  • getByte(String key, Number defaultValue)
  • getShort(String key, Number defaultValue)
  • getInt(String key, Number defaultValue)
  • getLong(String key, Number defaultValue)
  • getBundle(String key)
  • getUri(String key)
  • getBooleanArray(String key)
  • getByteArray(String key)
  • getShortArray(String key)
  • getCharArray(String key)
  • getIntArray(String key)
  • getIntegerArrayList(String key)
  • getLongArray(String key)
  • getFloatArray(String key)
  • getDoubleArray(String key)
  • getStringArray(String key)
  • getUriArray(String key)
  • getUriArrayList(String key)
  • getParcelableAsString(String key)
  • getParcelableArrayAsString(String key)
  • getParcelableArrayListAsString(String key)
  • getParcelable(String key)
See action Script for a description of the scripting language.
A variable is a container for a value that can be used in many actions and conditions to dynamically define a part of a text.
See action Script for a description.

Supplied Variables
result_code (only if Send ordered broadcast is enabled)
the returned result code
operation (only if Send ordered broadcast is enabled)
string "ok", when result_code was -1, "cancel" otherwise
data_string (only if Send ordered broadcast is enabled)
the data of the received intent as a string
abort_broadcast (only if Send ordered broadcast is enabled)
boolean flag indicating whether or not the broadcast receiver aborted the broadcast.