The sendintent Command

sendintent sends an Android Intent to the device to start an activity, server, or broadcast.

A sendintent script command requires two parameters: the type of intent and the intent URL.

Note: For use within SOTI MobiControl, before the Intent URL, you must add one of the following:
  • sendintent -a
  • sendintent -b
  • sendintent -s
Depending on whether the Intent is an activity (-a), broadcast (-b), or a service (-s).

Then you can compose the Intent URL using one of two different kinds of syntax. Either the Intent URI, which uses conventional URI format, or using the following format:

"intent:[dataURI]#Intent;[schemeOfTheDataURI];[action=];[component=];[category=];[launchFlags=];[extraKeyValuePair=];end"

Where:

Parameter Description
[dataURI] The data to operate on, expressed as an URI. In most cases, the data that follows is simply #Intent;
Note: Do not keep or replace [dataURI] in your final script. This is a pretextual categorization of #Intent;. In other words, this indicates the start of the Intent-specific parameters.
[schemeOfTheDataURI] If using #Intent;, it becomes one or more combinations of action, component, category, launchFlags, and/or extraKeyValuePair. Similar for [dataURI] above, do not keep or replace [schemeOfTheDataURI] in your final script. This is a pretextual categorization of the rest of the inputs that follow after it.
action This specifies the Intent's performed action. Common actions include:
  • intent.action.VIEW: View something such as a webpage or a contact.
  • intent.action.SEND: Send data to someone such as an email or text message.
  • intent.action.MAIN: Start the main activity. This is especially used in OTA firmware update sendintent scripts, though not always.
  • intent.action.EDIT: Typically used in Intents to invoke an activity that enable the user to edit the data provided in the Intent.
  • Set the action using the syntax action=[actionName]
Note: Actions also have "standard actions" which the app developer set as a default. If the developer set a standard action in the app, there is no need to set the action in the Intent. Developers usually set this to match the context of the called Intent; such as VIEW, MAIN, or EDIT as above.
component Specifies an explicit name of a component class to use for the Intent. This specifies the component (i.e., the specific activity or service) that should handle the Intent. It is in the form component=[packageName/className], where packageName is the app's package name and className is the name of the specific invoked class. If you don’t specify the activity, then Intent uses the default activity of the app.
category This specifies any other information about the kind of component that should handle the Intent. Categories provide further details about the action the Intent must perform.
  • intent.category.DEFAULT: The default category.
  • intent.category.LAUNCHER: Indicates the activity is a main entry point.
  • Set categories using the syntax category=[categoryName].
launchFlags These specify how you should handle the Intent in terms of the activity stack. Flags control the behavior of activities, such as whether to create a new task. Common flags include:
  • FLAG_ACTIVITY_NEW_TASK: Start a new task.
  • FLAG_ACTIVITY_CLEAR_TOP: If the activity is already running, bring it to the top and clear everything on top of it.
  • Set flags using the syntax launchFlags=[flagName]
Note: These are sometimes used in OTA firmware scripts for the upgrade process to have its own task to isolate it from the app that launched it.
extraKeyValuePair This is a Bundle of any further information. This specifies any extra data to be passed along with the Intent. Extras are key-value pairs that carry further information. For example:
  • extraKeyValuePair=key1=value1;key2=value2: Adds two extras with keys key1 and key2 and values value1 and value1

It is also possible to add an extra to the Intent. Extra options are:

  • b for byte
  • B for boolean
  • c for character
  • d for double
  • f for float
  • i for integer
  • l for long
  • s for short
  • S for string
They would then be input into the sendintent script using SOTI MobiControl's following syntax requirements:
  1. The single character code for the data type.
  2. Delimited with a period.
  3. The name of the value.
  4. The equals sign.
  5. The value required.
Here are some examples:
  1. S.filePath=/storage/emulated/0/update.zip
    Important: You must rename the firmware file as update.zip for this to work.
  2. S.filename=\sdcard\Download\update.zip
  3. S.path=/sdcard/NFT10-GL_V8.00.004.zip
  4. B.isSilence=false
  5. i.reboot=1
  6. B.enable=true

Explanation and Breakdown of a General Example sendintent Script

Combining all the above scheme definitions together, consider the following general example:

intent:http://www.example.com#Intent;scheme=http;action=android.intent.action.VIEW;component=com.example/.MainActivity;category=android.intent.category.BROWSABLE;launchFlags=FLAG_ACTIVITY_NEW_TASK;S.url=http://www.example.com;end
Table 1. Breakdown of above mentioned example:
Parameter Description
intent:http://www.example.com Specifies the data URI http://www.example.com.
#Intent; Begins the Intent parameters.
scheme=http; Specifies the scheme http.
action=android.intent.action.VIEW; Specifies the action VIEW.
component=com.example/.MainActivity; Specifies the component com.example/.MainActivity.
category=android.intent.category.BROWSABLE; Specifies the category BROWSABLE.
launchFlags=FLAG_ACTIVITY_NEW_TASK; Specifies the category NEW_TASK.
S.url=http://www.example.com;: This is using extraKeyValuePair. Adds an extra with key key and value http://www.example.com.
End Ends the Intent construction.

Result: This command constructs an Intent to view the URL http://www.example.com using the MainActivity of the com.example package, with the specified category, launch flags, and extra data.

Sample sendintent Scripts

Task Sample Script Command
To open notepad sendintent -a "intent://com.google.provider.NotePad/notes/1#Intent;scheme=content;action=android.intent.action.EDIT;component=com.example.android.notepad/.NoteEditor;end"
To play a video file sendintent -a "intent:file:///sdcard/Download/www/Email.wmv#Intent;type=video/x-ms-wmv;component=com.cooliris.media/.MovieView;launchFlags=0x4000000;end"
To install a system update on an encrypted Motorola device sendintent -b "intent:#Intent;action=com.motorolasolutions.intent.action.UPDATE_PACKAGE;S.file=/sdcard/Download/update.zip;end"
To add a string extra called toLock with a value of "lock" sendintent -b "intent:#Intent;action=android.intent.SES.WAKE_LOCK;S.toLock=lock;end;"
To tell the device's browser to open a specific webpage sendintent -a "https://<URL>#Intent;action=android.intent.action.VIEW;end"