Action.sendBroadcast()
Overview
Sends an Android broadcast to all listening receivers.
Broadcasts are sent as intents. Intents are represented in JavaScript as an object with certain properties.
Added in version 2.0.7
Format
Action.sendBroadcast(intent);
Intent object properties
Value | Description | Type | Required | Notes |
---|---|---|---|---|
action | A string representing the broadcast action. | String | Required | |
extras | Passes additional data to the intent broadcast. | Array of objects | Optional |
See the description for extras in the table below. |
Extras
Value | Description | Type | Required | Notes |
---|---|---|---|---|
name | The name of the extra. | String | Required | |
value | The value of the extra. | String, Integer, Boolean, array of String, array of Integer, array of Boolean | Required | arrays added in version 2.1.11 |
type | The value type. One of "string", "integer", or "boolean". | String | Optional | If not specified, a type will be assigned based on the JavaScript type of the first value in arrays. For arrays, use the same three types to represent the type for all values in the array. |
Example
Copy
/* Sends a broadcast that is interpreted as a scan by Velocity.
*/
Action.sendBroadcast({
action: "com.wavelink.intent.action.BARCODE",
extras: [
{ name:"scan.symbology_type", value:"UPCA", type:"string" },
{ name:"scan.data_string", value:"1234567890", type:"string" },
]
});