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.
sendintent -a
sendintent -b
sendintent -s
-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:
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.
|
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:
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:
|
It is also possible to add an extra to the Intent. Extra options are:
b
for byteB
for booleanc
for characterd
for doublef
for floati
for integerl
for longs
for shortS
for string
sendintent
script using SOTI MobiControl's following syntax requirements:- The single character code for the data type.
- Delimited with a period.
- The name of the value.
- The equals sign.
- The value required.
S.filePath=/storage/emulated/0/update.zip
Important: You must rename the firmware file asupdate.zip
for this to work.S.filename=\sdcard\Download\update.zip
S.path=/sdcard/NFT10-GL_V8.00.004.zip
B.isSilence=false
i.reboot=1
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
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" |