The sendintent Command
sendintent sends an Android intent to the device to start an activity, server, or broadcast.
An sendintent script command requires two parameters: the type of intent and the intent URL.
The type of intent can be an activity (-a), a service (-s), or a broadcast (-b).
The intent URL is composed 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"
It is also possible to add an extra to the intent. Extra options are:
bfor byteBfor booleancfor characterdfor doubleffor floatifor integerlfor longsfor shortSfor string
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/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/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" |