Overview of MDM commands

This is an overview of all MDM commands and their attributes.

Article overview

ProcessSubcommands
ChangePermission
ChangePreference
ChangeProperty
ChangeSetting
Change NTP server
Enable Keep Awake option
CopyFile
DeletePath
DownloadFile
EnablePackage
EnableRestriction
InstallCertificate
InstallPackage
RebootDevice
SendBroadcast
SetupEthernetMode
SetupEthernetProxy
ShowDialog
StartActivity
StartExecutable
StartPackage
StartService
StopPackage
UninstallPackage
WriteFile

ProcessSubcommands

A special command that defines a list of multiple commands to be executed one by one.

Name Type Description Optional
subcommands Array array of commands to be processed yes
success String values: ALL, SINGLE
Defines one of the two conditions for when execution of this command is considered successful.
ALL: successful when all subcommands finish successfully
SINGLE: successful when at least one of the subcommands finish successfully
 

This example shows how to change preferences for inactive days and hours. This list of commands would define that a scheduled update would be performed only on Saturdays and Sundays between 9 PM and 4 AM.

{
"command": "processSubcommands",
"success": "all",
"subcommands": [
{
"command": "changePreference",
"package": "com.emteria.update",
"category": "com.emteria.update_preferences",
"key": "prefs_schedule_days",
"type": "set",
"value": ["6", "7"]
},
{
"command": "changePreference",
"package": "com.emteria.update",
"category": "com.emteria.update_preferences",
"key": "prefs_schedule_time_start",
"type": "string",
"value": "21:00"
},
{
"command": "changePreference",
"package": "com.emteria.update",
"category": "com.emteria.update_preferences",
"key": "prefs_schedule_time_end",
"type": "string",
"value": "04:00"
}
]
}

ChangePermission

Grants or revokes permissions for the given package.

Name Type Description Optional
package String android app package name
e.g. com.android.calendar
 
permission String android permission name
e.g. android.permission.BLUETOOTH
 
action String Values: grant/revoke  

ChangePreference

Changes value of a preference with the given key for the requested package and category.

Name Type Description Optional
package String android app package name
e.g. com.android.calendar
 
category String Android SharedPreferences category (name of the app’s shared preferences file without the .xml suffix)  
type String BOOL, FLOAT, INT, LONG, SET, STRING  
key String Name of the preference to be changed  
value String Value of the preference to be changed yes

ChangePreference Examples

Enable “Hide Back button”:

{  
"command": "changePreference",
"package": "com.emteria.kiosk",
"category": "com.emteria.kiosk_preferences",
"key": "prefs_hide_back_key",
"type": "bool",
"value": true
}

Enable “Hide Home button”:

{  
"command": "changePreference",
"package": "com.emteria.kiosk",
"category": "com.emteria.kiosk_preferences",
"key": "prefs_hide_home_key",
"type": "bool",
"value": true
}

Set “Default website”:

{
"command": "changePreference",
"package": "com.emteria.kiosk",
"category": "com.emteria.kiosk_preferences",
"key": "prefs_default_website",
"type": "string",
"value": https://www.yoururl.com
}

ChangeProperty

Change value of the given system property, equivalent to adb shell setprop "property" "value".

Name Type Description Optional
property String system property name
e.g. persist.sys.vncd.enabled
 
value String value of the property yes

ChangeSetting

Change value of the given system setting, equivalent to adb shell settings set "section" "key".

Name Type Description Optional
section String GLOBAL, SYSTEM, SECURE  
type String BOOL, FLOAT, INT, LONG, SET, STRING  
key String Name of the setting to be changed
e.g. sound_effects_enabled
 
value String value of the property yes

 

Examples:

Change NTP server

Section Name: Global
Value type: String
Settings key name: ntp_server
New Value: de.pool.ntp.org

Enable Keep Awake option

Section name: Global

Setting type: Int

Setting key: stay_on_while_plugged_in

New value: 7 

CopyFile

Copy files from source to target.

Name Type Description Optional
source String source path  
mode int file permissions  
destination String target path  

DeletePath

Deletes given path.

Name Type Description Optional
path String path to delete  

DownloadFile

Downloads file from url.

Name Type Description Optional
url String source url  
path String target path  
mode int file permissions  

EnablePackage

Enables or disables a package.

Name Type Description Optional
package String android app package name
e.g. com.android.calendar
 
state String values:
1 – enabled
0 – disabled
 

EnableRestriction

Enables or disables a user restriction. This option is available only when the device admin component is active on the device.

Name Type Description Optional
key String restriction name  
state String values:
1 – adds user restriction
0 – removes user restriction
 

InstallCertificate

Installs a certificate from the given path. This option is available only when the admin component is active on the device.

Name Type Description Optional
path String path to the certificate file  

InstallPackage

Installs an app package from the given url.

Name Type Description Optional
url String URL of the package file  
package String android app package name
e.g. com.android.calendar
 
version int package version number  

RebootDevice

Reboots device with given option.

Name Type Description Optional
reason String option for reboot yes

SendBroadcast

Sends broadcast with the given intent.

Name Type Description Optional
intent String JSON String that may contain optional intent details
category, action, extras. Command fails if any of the attributes is declared, but empty.
 
Subattributes of intent:      
action String Intent action, like “android.intent.action.MAIN” yes
component String Intent component yes
extras Array array of intent extras yes
Subattributes of extras:      
type String BOOL, FLOAT, INT, LONG, SET, STRING yes
key String key of the extra yes
value String extra value yes

SetupEthernetMode

Sets up either DHCP or static Ethernet mode.

Name Type Description Optional
mode String IP mode, values “dhcp” or “static”
“dhcp” if missing
yes
ip String IP address, empty if missing yes
gateway String empty if missing yes
netmask String empty if missing yes
dns String empty if missing yes

SetupEthernetProxy

Sets up proxy.

Name Type Description Optional
mode String Proxy mode, values “none”, “static” or  “pac”
empty if missing
yes
host String Proxy host, empty if missing yes
port String empty if missing yes
pac String PAC URL, empty if missing yes
exclusions String Hosts excluded from using the proxy connection in the form of a String with comma separated values.
empty if missing
yes

ShowDialog

Show dialog to identify the device. Only available on emteria.OS 11.3.11 or higher.

Name Type Description Optional
message String User written message that is displayed in the dialog  yes
time String Set dialog duration yes

StartActivity

Starts activity with the given intent.

Name Type Description Optional
intent String JSON String that may contain optional intent details
category, action, extras. Command fails if any of the attributes is declared, but empty.
 
Subattributes of intent:      
action String Intent action, like “android.intent.action.MAIN” yes
component String Intent component yes
extras Array array of intent extras yes
Subattributes of extras:      
type String BOOL, FLOAT, INT, LONG, SET, STRING yes
key String key of the extra yes
value String extra value yes

StartExecutable

Runs a shell command on the device.

Name Type Description Optional
executable String Command to run in the shell  

StartPackage

Starts a package installed on the device.

Name Type Description Optional
executable package android app package name
e.g. com.android.calendar
 

StartService

Starts service with the given intent.

Name Type Description Optional
intent String JSON String that may contain optional intent details
category, action, extras. Command fails if any of the attributes is declared, but empty.
 
Subattributes of intent:      
action String Intent action, like “android.intent.action.MAIN” yes
component String Intent component yes
extras Array array of intent extras yes
Subattributes of extras:      
type String BOOL, FLOAT, INT, LONG, SET, STRING yes
key String key of the extra yes
value String extra value yes

StopPackage

Force stops a package installed on the device.

Name Type Description Optional
executable package android app package name
e.g. com.android.calendar
 

UninstallPackage

Uninstalls a package installed on the device.

Name Type Description Optional
package String android app package name
e.g. com.android.calendar
 
version String Version if the installed package  

WriteFile

Write content to a file.

Name Type Description Optional
path String Path of a file to update  
content String Text to write yes