Android custom commands
Custom commands allow you to execute remote actions on managed Android devices.
In addition to default device actions available in the MaaS360 Portal, you can use custom commands to execute dynamic actions on managed devices. After sending a custom command, you can track the execution status of all commands in the Device History page in the MaaS360 Portal. This feature requires MaaS360 for Android app version 7.40 or later.
Supported custom commands
Action | Description | Command |
---|---|---|
Enable kiosk mode | Launches kiosk mode on the devices. The following requirements must be met:
|
enable-kiosk |
Launch app | Launches the specified app on the device. The following requirement must be met:
|
launch-app <package name>. Examples:
|
Start activity | Starts an instance of the activity specified by the intent. Device support:
The following requirements must be met:
|
start-activity <intent options> |
Start broadcast | Broadcast the specified intent to the device. | send-broadcast <intent options> |
Clear app data | Clears app data. This command supports multiple app IDs. Requirements:
|
clear-app-data <comma-separated app IDs>
|
Intent options
Intent options | Description | Example |
---|---|---|
-a | Set the action on the intent |
|
-c | Add a category to an intent | start-activity -c android.intent.category.HOME -a android.intent.action.MAIN: Launches the Home screen. |
-d | Set the data URL on the intent | start-activity -a android.intent.action.VIEW -d http://www.google.com: Opens google.com in a browser app. The command fails if a browser app is not installed. |
-t | Set the MIME type on the intent | start-activity -t image/* -a android.intent.action.VIEW: Opens the Gallery or any app that displays images. A list of apps is displayed if there are multiple apps available. |
-n | Set the specific intent component | start-activity -n com.example.sampleapp/.SaveFileActivity: Opens the sample app's Save File screen. If "SaveFileActivity" is not exported, the command fails. |
-es, -eb, -ei, -ed, -en, -eia, -esa, -eba, -eda (For string data, you must use quotes around the string to specify the value.) |
Add data/extras as a key-value pair to intent |
-es - String start-activity -n com.example.sampleapp/.MyActivity -es EXTRA "Life is Great": Opens the specific activity "MyActivity" and sends the string data in the form of a key-value pair (key: "EXTRA" value: "Life is Great") to the activity. If "MyActivity" is not exported, the command fails. |
-eb - Boolean start-activity -n com.example.sampleapp/.MyActivity -eb Status true: Opens the specific activity "MyActivity" and sends the boolean data in the form of a key-value pair (key:"Status" value: true) to the activity. Note: If "MyActivity" is not exported, the command fails. |
||
-ed - Double/Float start-activity -n com.example.sampleapp/.MyActivity -ed Code 999.9878: Opens the specific activity "MyActivity" and sends the double/float data in the form of a key-value pair (key:"Code" value: 999.9878) to the activity. If "MyActivity" is not exported, the command fails. |
||
-ei - Integer start-activity -n com.example.sampleapp/.MyActivity -ei Code 999: Opens the specific activity "MyActivity" and sends the integer data in the form of a key-value pair (key:"Code" value: 999) to the activity. If "MyActivity" is not exported, the command fails. |
||
-esa - String Array start-activity -n com.example.sampleapp/.MyActivity -esa Months "[Jan,Feb,March]": Opens the specific activity "MyActivity" and sends the string array data in the form of a key-value pair (key: "Months" value: "[Jan,Feb,Mar]") to the activity. If "MyActivity" is not exported, the command fails. |
||
-eba - Boolean Array start-activity -n com.example.sampleapp/.MyActivity -eba Status [true, false, false, false] : Opens the specific activity "MyActivity" and sends the boolean array data in the form of a key-value pair (key:"Status" value: [true, false, false, false]) to the activity. If "MyActivity" is not exported, the command fails. |
||
-eda - Double/Float Array start-activity -n com.example.sampleapp/.MyActivity -eda Codes [10.33, 12.33, 14.33, 15.33]: Opens the specific activity "MyActivity" and sends the double/float array data in the form of a key-value pair (key:"Codes" value: [10.33, 12.33, 14.33, 15.33]) to the activity. If "MyActivity" is not exported, the command fails. |
||
-eia - Integer Array start-activity -n com.example.sampleapp/.MyActivity -eia Codes [998, 999, 1000]: Opens the specific activity "MyActivity" and sends the integer array data in the form of a key-value pair (key:"Codes" value: [998, 999, 1000]) to the activity. If "MyActivity" is not exported, the command fails. |
||
-en - Null start-activity -n com.example.sampleapp/.MyActivity -en DataValue null: Opens the specific activity "MyActivity" and sends the null data in the form of a key-value pair (key: "DataValue" value: null) to the activity. If "MyActivity" is not exported, the command fails. If you want to pass null, use the -en option. If you use other options to pass null, the command fails. |
Custom command requirements
- The angle brackets < and > are not supported.
- You cannot use the word script, and the signs < and > more than once.
- The maximum character limit is 2500.
Pushing custom commands to devices
You can issue custom commands to an individual device or a group of devices.
- Go to Device Summary page is displayed. and then select a device. The
- Click More and then select Android Custom Command.
- Enter the custom command and then click Run.
- Go to .
- Hover over the More option below the device group and then select Manage Android Devices. The Manage Android Devices window is displayed.
- Select Android Custom Command in the Action drop-down.
- Enter the custom command and then click Run.
Tracking the execution status of commands
You can view the execution status of all the commands that were issued to the selected device in the Device History page.
- Completed: The action is successfully implemented on the device.
- Error: The action failed to execute and more details are provided under the Error Description column.