Remote Commands for Android
  • 18 Dec 2023
  • 7 Minutes to read
  • PDF

Remote Commands for Android

  • PDF

Article Summary

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

  1. Users should be subscribed to Scalefusion's Enterprise Plan
  2. The devices should be enrolled in Kiosk or Agent mode

Steps

Step 1: Create a Remote Command

  1. On the Scalefusion Dashboard, navigate to Remote Support > Remote Commands and click on Create
  2. This would bring up a pop-up with a list of commands to select from.
  3. 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.

FieldDescription
Enter a Name for the CommandEnter 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:

  • Implicit (selected by default): Implicit mode doesn't specify the component. In such cases, intent provides information on available components provided by the system that is to be invoked.
  • Explicit: Explicit mode specifies the component by providing the external class to be invoked.
Enter ActionEnter the action string for the command. For example, android.intent.action.VIEW
Select PackageSelect 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 NameEnter 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 NameEnter 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 TypeEnter a string for the data type of the intent.
Configure ExtrasAdd extra details that will passed along with the intent, like the key, its corresponding value, type etc.
The details like Action, Package, Class Name, Category Name, and Data Uri should be known to the admin in regards to the command that has to be remotely executed on the device.

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 Launch Activity, Launch Service, and Send Broadcast commands, you will need to enter a similar set of details in the form to launch the command.

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)


System packages and packages starting with com.promobitech cannot be uninstalled remotely.

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.

The Install Apps command works on EMM Managed devices

In the Remote Command window, click on the command Install Apps.

This opens the Install Apps window. Enter the following details:

FieldDescription
Enter a Name for the CommandEnter a name with which the command can be identified
Enter File PathEnter the folder/file path where the apk should be stored
Storage Location

Select the storage location from the following:

  • Internal
  • External
Auto-approve Installed applicationsWhen a device reports an application as installed, this setting (when enabled) automatically approves the application in the respective device profile.
Add more fieldAdds 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:

FieldDescription
Enter a Name for the CommandEnter a name with which the command can be identified
Enter File PathEnter a file or folder path from where the files are to be deleted
Enter file patternTo delete files in bulk, enter the pattern. For eg. *.* deletes all files, *.jpg deletes all jpg files
Delete FolderIf checked, it deletes the folder from the specified location
Add more fieldAdds 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.

The delete Files command works only for files on internal storage. Files on external SD cards cannot be deleted.

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.

FieldDescription
Enter a Name for the CommandEnter a name with which the command can be identified
Enter File PathEnter the folder/file path where the file is stored
Storage Location

Select the storage location of the file from the following:

  • Internal
  • External

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.

  1. Click on the three vertical dots under the Actions heading on the right for the command that has to be executed.
  2. Click on Run Now.
  3. 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:

These actions can be accessed by clicking on the three vertical dots under the Actions heading on the right

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.


Was this article helpful?