- 18 Dec 2023
- 7 Minutes to read
- Print
- PDF
Remote Commands for Android
- Updated on 18 Dec 2023
- 7 Minutes to read
- Print
- PDF
IT Admins want to remotely run a command on Android devices and see it’s output. Unlike Desktop environments where commands are driven via command prompt or PS, Android does not offer a Shell that can be invoked programmatically. Basically, the commands are nothing but Intents that they want to invoke remotely.
Intents are a way to interact with the devices remotely, like launching a system broadcast service or activity. Additionally, some actions fall under the category of commands and hence can be classified as Remote Commands. Some examples can be remotely deleting all files or a folder, launching an app etc.
With Scalefusion MDM, admins can create remote commands via Scalefusion Dashboard, which can then be launched on managed devices to perform a set of actions remotely. The document explains all about Remote Commands for Android devices.
Before You Begin
- Users should be subscribed to Scalefusion's Enterprise Plan
- The devices should be enrolled in Kiosk or Agent mode
Steps
Step 1: Create a Remote Command
- On the Scalefusion Dashboard, navigate to Remote Support > Remote Commands and click on Create
- This would bring up a pop-up with a list of commands to select from.
- Select a command. This opens a form. Fill in the required details and click Save. The commands are explained below
Launch Activity
When you want to remotely launch a specific activity in an installed app, use this command. The command basically describes the activity to start and carries any necessary data. Some examples of launching an activity are dialing a number, launching a map based on address, launching contacts etc.
To launch an activity, select Launch Activity from the list of commands
A form will open. Fill in the details as required.
Field | Description |
Enter a Name for the Command | Enter a name with which the command can be identified |
Select Mode | Select the appropriate mode for the intent, which allows the right app to be targetted from the following: |
Enter Action | Enter the action string for the command. For example, android.intent.action.VIEW |
Select Package | Select or enter the package name to which this command is targeted. The package can be chosen from the list in the drop-down. Alternatively, you can enter the package name if it is not in the list by selecting the checkbox Enter a Package not in the List Package Name has to be selected when the mode is Explicit |
Enter Class Name | Enter the class name within the package to which this command is targeted. For, eg. com.android.settings.network.telephony.MobileNetworkActivity Class Name has to be entered when the mode is Explicit |
Enter Category Name | Enter the category string that will be passed along with the command. For example, android.intent.category.HOME |
Enter Data Uri | The action string for the intent that will be created. For e.g. To launch an activity like Launch Map point based on address, the following would be the Data Uri: geo:0,0?q=1600+Amphitheatre+Parkway,+Mountain+View,+California |
Enter Data Type | Enter a string for the data type of the intent. |
Configure Extras | Add extra details that will passed along with the intent, like the key, its corresponding value, type etc. |
For example, to launch a map point based on address, the following details need to be entered. In this case, the Map app should be already installed on the device.
Launch Service
A service is an application component that can perform long-running operations in the background. It does not provide a user interface. For example, a service can handle network transactions, play music, start service to display notifications always for Remote Commands App etc Use this command when you want to remotely launch a service in an installed app by selecting Launch Service from the list of commands and entering details in the form.
Send Broadcast
A broadcast is a message that any app can receive. The system delivers various broadcasts for events, such as when the system boots up or the device starts charging. You can deliver a broadcast to other apps remotely by selecting Send Broadcast from the list of commands and entering details in the form.
For example, you can use Send Broadcast to uninstall apps remotely. This helps IT Admins uninstall apps once they detect an unwanted app is installed on the device. To uninstall, select the following:
- Type: Implicit
- Action: com.mdm.uninstallapps
- Extras
- Type: String Array
- Key: uninstall_app_list
- Value: app package name (eg. com.whatsapp)
Update Scalefusion Notification Message
You can use Send Broadcast to configure a customized Notification message that appears on the Notification bar when device is enrolled and locked with Scalefusion. To configure, select the following:
- Type: Implicit
- Action: com.mdm.action.SERVICE_MESSAGE
- Extras
- String
- Key: extras_key
- Value: Enter the message that should be displayed in notification
Install Apps
With this command, you can install an APK file at a specified storage location and file path, which remotely installs the apps on the devices. You should have the application downloaded on the device.
In the Remote Command window, click on the command Install Apps.
This opens the Install Apps window. Enter the following details:
Field | Description |
Enter a Name for the Command | Enter a name with which the command can be identified |
Enter File Path | Enter the folder/file path where the apk should be stored |
Storage Location | Select the storage location from the following:
|
Auto-approve Installed applications | When a device reports an application as installed, this setting (when enabled) automatically approves the application in the respective device profile. |
Add more field | Adds another entry field for you to specify another file path, and storage location for the APKs to be installed |
For example, the following will install the AppDetail.apk file from the internal storage.
Delete Files / Folders
This command deletes files or all files in a given folder remotely. In the Remote Command window, click on the command Delete Files / Folders.
This opens the Delete Files Folders command window, where you need to specify the file/folder location and other details:
Field | Description |
Enter a Name for the Command | Enter a name with which the command can be identified |
Enter File Path | Enter a file or folder path from where the files are to be deleted |
Enter file pattern | To delete files in bulk, enter the pattern. For eg. *.* deletes all files, *.jpg deletes all jpg files |
Delete Folder | If checked, it deletes the folder from the specified location |
Add more field | Adds another entry field for you to specify another file/folder path and file pattern for the files to be deleted |
For example, the following will delete the AppDetail.apk file stored at the specified location on the device.
Launch a File
With this command, you can remotely launch files on devices. The file should be present on the device. In the Remote Command window, click on the command Launch File.
This opens the Launch file command window, where you need to specify the file path and other details. The command, when executed, will launch the specified file.
Field | Description |
Enter a Name for the Command | Enter a name with which the command can be identified |
Enter File Path | Enter the folder/file path where the file is stored |
Storage Location | Select the storage location of the file from the following:
|
For example, the following will pick the abc.jpg file from the external storage and open it on the device's gallery
Step 2: Execute (run) a command
Once a command is created, the next step is to run it from the dashboard to be executed on the device. The commands created are listed with the following details.
- Click on the three vertical dots under the Actions heading on the right for the command that has to be executed.
- Click on Run Now.
- This opens up the window where you need to select the Device Groups / Devices on which the command has to be executed. Select the Device Groups / Devices and click Execute
The command will be executed, and the action can be viewed on the device.
Other Actions on Remote Commands
Other actions that can be performed on remote commands are:
Last Run Report: Gives a summarized report of the status of the commands installed on the device. For example, for a Launch Activity command, the Last Run report would display the following information:
- DEVICE NAME & STATUS
- LAST SEEN
- ACKNOWLEDGED
- STATUS
- TIMESTAMP
- ERROR
Similarly, for other commands, related information is displayed in the report. This information can be downloaded in CSV format.
Edit: With this, you can edit the command details
Clone: Creates a copy of the command. The copied one has a copy added to the command name with which it can be identified
Delete: Deletes the Remote Command. A command, once deleted, cannot be recovered. To confirm the deletion of the command, you need to enter your Scalefusion Dashboard login password.