Skip to main content

Execute JavaScript Commands on Android Devices Using SureMDM

SureMDM allows administrators to deploy JavaScript commands on Android devices to automate various tasks. To create a job that runs custom scripts and to deploy it to enrolled device(s) or group(s) remotely, follow the steps below:

  1. On the SureMDM Web Console, navigate to Jobs > New Job > Android > Run Script

  2. In the Run Script prompt:

    • Enter a Job Name
    • Select JavaScript from the drop-down menu on the right
    • Enter your JavaScript code in the script box
  1. After entering and verifying your script, click Save to save the job.

    The newly created job will appear in the Jobs List section.

  2. Navigate back to the Home tab and select the target Android device(s) or group(s).

  3. Click Apply to open the Apply Job/Profile To Device prompt.

  4. In the prompt, select the job(s) you created and click Apply to deploy them to the selected device(s).


Below is the list of JavaScript commands supported:

note

The script must begin with the prefix !#suremdmjs, which signals SureMDM to execute it as a JavaScript command on the device.

  1. Command: log(logMsg)

    Description: Use this method for logging custom messages during script execution. These logs can help in monitoring script activity or diagnosing issues during policy deployment or device interaction.

    Script:


    \!\#suremdmjs
    suremdmjs.log('Send Test Log to Console');

    Parameters: logMsg (String) – message to be sent

    Return Type: void

    Limitations: N/A


  1. Command: setDeviceName(deviceName)

    Description: This command allows you to programmatically change the name of the device as it appears in SureMDM.

    Script:

     \!\#suremdmjs  
    suremdmjs.setDeviceName('Client0001');

    Parameters: deviceName (String) – specify the deviceName that is to be set

    Return Type: void

    Limitations: N/A


  1. Command: getImei()

    Description: Retrieves the International Mobile Equipment Identity (IMEI) of the device.

    Script:

     \!\#suremdmjs  
    suremdmjs.getImei();

    Parameters: N/A

    Return Type: String

    Limitations: Supported only on EA & Device Owner devices.


  1. Command: getSerialNumber()

    Description: Retrieves the serial number of the device.

    Script:

     \!\#suremdmjs  
    suremdmjs.getSerialNumber();

    Parameters: N/A

    Return Type: String

    Limitations: Supported only on EA, DO & Knox devices.


  1. Command: getProp(prop)

    Description: Allows fetching values of various system properties.

    Script:


    \!\#suremdmjs

    var dhcpValue = suremdmjs.getProp("dhcp.tftpsname"); var deviceDisplay = suremdmjs.getProp("ro.config.device.display");

    Parameters: prop (String) – specify the system property

    Return Type: String

    Limitations: N/A


  1. Command: reboot()

    Description: Initiates a device reboot.

    Script:

     \!\#suremdmjs  
    suremdmjs.reboot();

    Parameters: N/A

    Return Type: void

    Limitations: N/A


  1. Command: uninstall(packageName)

    Description: Uninstalls the application with the given package name from the device.

    Script:

     \!\#suremdmjs  
    suremdmjs.uninstall('com.whatsapp');

    Parameters: packageName (String) – specify the name of the package that is to be uninstalled

    Return Type: void

    Limitations: Supported only on EA, DO and Knox devices.


  1. Command: allowUninstall(pObjPackageNames)

    Description: This function enables the uninstallation of a list of specified applications

    Script:

     \!\#suremdmjs  
    const lisfOfApplications = ["com.whatsapp", "com.gears42.vpntunnel"]; suremdmjs.allowUninstall(lisfOfApplications );

    Parameters: pObjPackageNames (String) – specify an array of packages that are allowed to be uninstalled

    Return Type: void

    Limitations: Supported only on DO devices.


  1. Command: install(pStrFilePath)

    Description: Installs an application from the provided file path.

    Script:


    \!\#suremdmjs
    suremdmjs.install('/sdcard/Chrome.apk');

    Parameters: pStrFilePath (String) – specify the name of the package that is to be installed

    Return Type: void

    Limitations: Supported only for EA, DO and Knox devices.


  1. Command: blockUninstall(pStrPackageNames)

    Description: This function prevents the uninstallation of a list of specified applications.

    Script:

     \!\#suremdmjs  
    const lisfOfApplications = ["com.whatsapp", "com.gears42.vpntunnel"]; suremdmjs.blockUninstall(lisfOfApplications);

    Parameters: pStrPackageNames (String) – specify an array of packages that are to be blocked from uninstallation

    Return Type: void

    Limitations: Supported only on DO devices.


  1. Command: deleteAFWAccount()

    Description: Removes the Android for Work (AFW) account from the device.

    Script:

     \!\#suremdmjs  
    suremdmjs.deleteAFWAccount();

    Parameters: N/A

    Return Type: void

    Limitations: Supported only on DO enrolled devices.


  1. Command: setTimeZone(pStrTimeZone)

    Description: Configures the device's time zone.

    Script:

     \!\#suremdmjs  
    suremdmjs.setTimeZone('America/Mexico_City');

    Parameters: pStrTimeZone (String) – specify the time zone which needs to be configured on the device.

    For reference: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

    Return Type: void

    Limitations: Supported only on DO enrolled devices.


  1. Command: addAFWAccount()

    Description: Adds an Android for Work (AFW) account to the device if one isn't already present.

    Script:


    \!\#suremdmjs
    suremdmjs.addAFWAccount();

    Parameters: N/A

    Return Type: void

    Limitations: Supported only on DO enrolled devices.


  1. Command: forceAddAFWAccount()

    Description: This command can be used to re-establish an Android for Work (AFW) account.

    Script:


    \!\#suremdmjs
    suremdmjs.forceAddAFWAccount();

    Parameters: N/A

    Return Type: void

    Limitations: Supported only on DO devices.


  1. Command: turnOnDataRoaming(pBoolDataRoamingState)

    Description: Controls the data roaming setting on the device.

    Script:


    \!\#suremdmjs
    suremdmjs.turnOnDataRoaming(true);

    Parameters: pBoolDataRoamingState (boolean) – specify true if Roaming Data is to be turned ON, else specify false

    Return Type: void

    Limitations: Supported only on DO devices.


  1. Command: configureSureLock()

    Description: Sets SureLock as the default home screen.

    Script:

     \!\#suremdmjs  
    suremdmjs.configureSureLock();

    Parameters: N/A

    Return Type: void

    Limitations: Supported only on DO devices.


  1. Command: removeAccountFromDevice(pStrScript)

    Description: This function removes accounts of a specified type from the device. E.g. Work: com.google.work, Gmail: com.google, Facebook: com.facebook.auth.login, Whatsapp: com.whatsapp, Microsoft Outlook : com.microsoft.office.outlook, Exchange : com.android.exchange

    Script:

     \!\#suremdmjs  
    suremdmjs.removeAccountFromDevice('com.google');

    Parameters: Type of account to be removed

    Return Type: void

    Limitations: Supported only for DO


  1. Command: disableNotificationPanel(pBoolDisableNotificationPanel)

    Description: Enables or disables the notification panel and quick settings.

    Script:

     \!\#suremdmjs  
    suremdmjs.disableNotificationPanel(true);

    Parameters: pBoolDisableNotificationPanel (boolean) – specify true if the Notification panel is to be disabled, else specify false

    Return Type: void

    Limitations: Supported only on DO devices.


  1. Command: configureWifiSettings(pStrScript)

    Description: This function allows comprehensive configuration of Wi-Fi settings on the device using a JSON string.

    Script:

     \!\#suremdmjs  
    suremdmjs.configureWifiSettings({"SSID" : "abcde","password" : "12345678","securityType" : "WPA/WPA2 PSK","connectAutomatically": "true","hiddenNetwork" :"false","useProxy":"false","useStaticIP":"true","staticIP":"192.168.5.128","gateWayIP":"192.168.1.6","NetworkPrefixLength":"23","DNS1": "8.8.9.8","DNS2":"8.8.4.6"});

    Parameters:

    pStrScript (String) – takes SSID, PASSWORD BASE64 DEFAULT, password, security Type(0-Open, 1-WEP, 2-WPA/WPA2 PSK, 3-EAP/TLS, 4-PEAP, 5-TTLS, 6-PWD, 7-SIM, 8-AKA), connectAutomatically, hiddenNetwork, useProxy, proxyHost, proxyPort, byPassHost, useStaticIP, staticIP, gateWayIP, NetworkPrefixlength, DNS1, DNS2

    Return Type: void

    Limitations: Supported only on EA, DO and Knox devices.


  1. Command: setDefaultLauncherSureLock()

    Description: Sets SureLock as the default launcher application on the device.

    Script:

    \!\#suremdmjs  
    suremdmjs.setDefaultLauncherSureLock();

    Parameters: N/A

    Return Type: void

    Limitations: Supported only for DO enrolled devices.


  1. Command: grantRunTimePermissions(pStrPackageNames, pStrPermissionList)

    Description: This powerful command allows granting runtime permissions to applications, which is useful for silently deploying and configuring apps that require specific permissions.

    Script:

     \!\#suremdmjs  
    suremdmjs.grantRunTimePermissions('*','*');
    suremdmjs.grantRuntimePermission('com.irisvision.manager2$com.nix','android.permission.RECORD_AUDIO$android.permission.CAMERA');

    Return Type: void

    Limitations: Supported only on EA, DO and Knox devices.


  1. Command: wifiEnableOrDisable(pBoolEnableWifi)

    Description: Enables or disables the Wi-Fi on the device.

    Script:

     \!\#suremdmjs  
    suremdmjs.wifiEnableOrDisable(true);

    Parameters: pBoolEnableWifi (boolean) – specify true if wifi is to be enabled, else specify false

    Return Type: void

    Limitations: Supported for DO enrolled devices & works till Android 10 for others.


  1. Command: clearAllAppData()

    Description: This command performs a reset on all application data. Use with caution, as this will erase all user data associated with applications.

    Script:

     \!\#suremdmjs  
    suremdmjs.clearAllAppData();

    Parameters: N/A

    Return Type: void

    Limitations: Supported from Android 9 & above on DO enrolled devices.


  1. Command: disableKeyGuard(pBoolStatus)

    Description: For enabling or disabling the keyguard setting. The keyguard for the disabled has the same effect as choosing "None" as the screen lock type. However, this call has no effect if a password, PIN or pattern is currently set. If a password, pin or pattern is set after the keyguard was disabled, the keyguard stops being disabled.

    Script:

     \!\#suremdmjs  
    suremdmjs.disableKeyGuard(true);

    Parameters: pBoolStatus (boolean) – specify true if keyGuard is to be disabled, else specify false

    Return Type: void

    Limitations: Supported from Android 6 & above on DO enrolled devices.


  1. Command: setCustomProperty(pStrKey, pStrValue)

    Description: Allows setting individual custom properties on the device, which can be viewed and managed from the SureMDM console.

    https://knowledgebase.42gears.com/article/how-to-define-and-manage-custom-properties-via-suremdm/

    Script:

     \!\#suremdmjs  
    suremdmjs.setCustomProperty("key","value");

    Parameters:

    pStrKey (String) – specify custom property key

    pStrValue (String) – specify custom property value

    Return Type: void

    Limitations: N/A


  1. Command: setCustomPropertyList(propertiesJson)

    Description: This command enables bulk setting of custom properties using a JSON object.

    https://knowledgebase.42gears.com/article/how-to-define-and-manage-custom-properties-via-suremdm/

    Script:

     \!\#suremdmjs  
    var properties = {"customer": "42Gears","platform":"Android"};
    var propertiesJson = JSON.stringify(properties);
    suremdmjs.setCustomPropertyList(propertiesJson);

    Parameters:

    propertiesJson (String) – A JSON string representing the custom properties to be set. The JSON should have keys as property names and values as property values. Example: {"property1": "value1", "property2": "value2"}

    Return Type: void

    Limitations: N/A


  1. Command: getDataFromFile(filePath)

    Description: Reads the content of a file and returns it as a string.

    Script:

     \!\#suremdmjs  
    suremdmjs.getDataFromFile("/sdcard/DeviceInfo.xml");

    Parameters: filePath (String) – The path of the file to read data from.

    Return Type: String

    Limitations: N/A


  1. Command: writeDataToFile(filePath, pStrData)

    Description: This function overwrites the content of an existing file or creates a new one if it doesn't exist.

    Script:

     \!\#suremdmjs  
    var serialNo = suremdmjs.getSerialNumber();
    suremdmjs.writeDataToFile("/sdcard/DeviceSerialNo.txt",serialNo);

    Parameters: filePath (String) – The path of the file where the data will be written. pStrData (String) – The data to be written to the file.

    Return Type: boolean

    Limitations: N/A


  1. Command: appendDataToFile(filePath, pStrData)

    Description: This function adds data to the end of a file without overwriting existing content.

    Script:

     \!\#suremdmjs  
    var serialNo = suremdmjs.getSerialNumber();
    suremdmjs.appendDataToFile("/sdcard/DeviceSerialNo.txt",serialNo);

    Parameters:

    filePath (String) – The path of the file where the data will be written. pStrData (String) – The data to be written to the file.

    Return Type: boolean

    Limitations: N/A


  1. Command: deleteFile(filePath)

    Description: Removes a file from the device.

    Script:

     \!\#suremdmjs  
    suremdmjs.deleteFile("/sdcard/Download/Test.txt");

    Parameters: filePath (String) – The path of the file to be deleted.

    Return Type: void

    Limitations: N/A


  1. Command: moveFile(filePath, pStrDestPath)

    Description: Relocates a file or directory on the device.

    Script:

     \!\#suremdmjs  
    suremdmjs.moveFile("/sdcard/Download/A/test.txt","/sdcard/TEST/test.txt");

    Parameters:

    filePath (String) – The path of the file to be moved. pStrDestPath (String) – The destination path where the file should be moved.

    Return Type: boolean

    Limitations: N/A


  1. Command: renameFile(pStrOrgFile, pStrNewfile)

    Description: Changes the name of a file or directory.

    Script:

     \!\#suremdmjs  
    suremdmjs.renameFile("/sdcard/Download/D1/abcd.txt","test.txt");

    Parameters:

    pStrOrgFile (String) – The original file or directory path.

    pStrNewfile (String) – The new file or directory path.

    Return Type: boolean

    Limitations: N/A


  1. Command: copyFile(filePath, pStrDestPath)

    Description: Duplicates a file to a new location.

    Script:

     \!\#suremdmjs  
    suremdmjs.copyFile("/sdcard/Download/File1.txt","/sdcard/TEST/File1.txt");

    Parameters:

    filePath (String) – The path of the source file to be copied.

    pStrDestPath (String) – The destination path where the file should be copied.

    Return Type: boolean

    Limitations: N/A


  1. Command: listFiles(filePath)

    Description: Returns a JSON string listing files within a directory.

    Script:

     \!\#suremdmjs  
    suremdmjs.listFiles("/sdcard/Downloads");

    Parameters: filePath (String) – The path of the directory to list.

    Return Type: String

    Limitations: N/A


  1. Command: deleteDirectory(filePath)

    Description: Removes a directory from the device.

    Script:

     \!\#suremdmjs  
    suremdmjs.deleteDirectory("/sdcard/Download/Test/");

    Parameters: filePath (String) – The path of the directory to delete.

    Return Type: void

    Limitations: N/A


  1. Command: isDirectory(filePath)

    Description: Returns true if the path is a directory, false otherwise.

    Script:

     \!\#suremdmjs  
    suremdmjs.isDirectory("/sdcard/Download/Test/");

    Parameters: filePath (String) – The path to check

    Return Type: boolean

    Limitations: N/A


  1. Command: launchIntegratedSureLock()

    Description: Launches and configures the integrated SureLock as the default home screen.

    Script:

     \!\#suremdmjs  
    suremdmjs.launchIntegratedSureLock();

    Parameters: N/A

    Return Type: void

    Limitations: N/A


  1. Command: clearNotificationAndDisableSureLock()

    Description: Manages SureLock notifications and its enabled state.

    Script:

     \!\#suremdmjs  
    suremdmjs.clearNotificationAndDisableSureLock();

    Parameters: N/A

    Return Type: void

    Limitations: N/A


  1. Command: applySettings(settingsPath)

    Description: Imports SureMDM Agent settings from the specified path

    Script:

     \!\#suremdmjs  
    suremdmjs.applySettings('/sdcard/Downloads/NixSettings.xml');

    **Parameters**: settingsPath (String) – Nix Settings path

    Return Type: void

    Limitations: N/A


  1. Command: clearAppData(packages)

    Description: Clears the app data for specified applications.

    Script:

     \!\#suremdmjs  
    suremdmjs.clearAppData('com.android.chrome,com.google.android.apps.docs');

    Parameters: package (String) – name of applications separated by (,)

    Return Type: void

    Limitations: Supported only for EA, DO(Android 9+), Knox


  1. Command: sendMessage(message, accountid, subject)

    Description: Allows sending messages from the device to the SureMDM console.

    Script:

     \!\#suremdmjs  
    suremdmjs.sendMessage('Need help in granting few application permissions','1','Need Help');

    Parameters:

    message (String) – message to be sent

    accountid (String) – of MDM account

    subject (String) – subject of the message

    Return Type: void

    Limitations: N/A


  1. Command: changeNixSettings(jsonString)

    Description: Enables dynamic modification of various SureMDM Agent settings using a JSON string.

    Script:

     \!\#suremdmjs  
    suremdmjs.changeNixSettings('{
    "startNix": true,
    "setDeviceName": "MyDevice",
    "setAccountID": "12345",
    "setServerPath": "https://example.com/server"
    }')

    Parameters: jsonString (String) – A JSON string containing the configuration settings to be applied.

    Return Type: void

    Limitations: N/A


  1. Command: executeZebraRunscript(pStrScript)

    Description: Executes Zebra OEM SDK runscripts for advanced device management on Zebra devices.

    Script:

    var pStrScript = `<wap-provisioningdoc>
    <characteristic version="4.2" type="PowerMgr">
    <parm name="ResetAction" value="4"/>
    </characteristic>
    </wap-provisioningdoc>`;
    suremdmjs.executeZebraRunscript(pStrScript);

    Parameters: pStrScript (String) – runscript to be executed

    Return Type: void

    Limitations: Support only for Zebra device with OEMAgent Installed.


  1. Command: getAllowedApplicationsJSON()

    Description: Returns a JSON string containing information about allowed applications, useful for Kiosk mode configurations.

    Example:


    [
    {
    "mIntShortcutID": -1,
    "mIntType": 0,
    "mStrBase64ImageIcon": "base42ImageString",
    "mStrIdentifier": "com.google.android.calculator::com.android.calculator2.Calculator",
    "mStrLocalisedTitle": "Calculator",
    "mStrOriginalTitle": "Calculator",
    "mStrPackageName": "com.google.android.calculator",
    "mStrSpecialIcon": "",
    "mStrSpecialTitle": "",
    "mintShortcutType": 0
    }
    ]

    Script:

     \!\#suremdmjs  
    suremdmjs.getAllowedApplicationsJSON();

    Parameters: N/A

    Return Type: String

    Limitations: N/A


  1. Command: launchApp(pStrPackageName, pintType, pStridentifier, pintShortcutID)

    Description: Used to launch applications within a SureLock Kiosk environment.

    Script:

     \!\#suremdmjs  
    suremdmjs.launchApp("com.nix",0,"com.nix::com.gears42.apnmanager.ApnManager",-1);

    Parameters: pStrPackageName (String) – The package name of the application to be launched. pintType (int) – The type of the application (0 for application, 2 for shortcut, 3 for website). pStridentifier (String) – The identifier of the application (e.g., packagename:classname). pintShortcutID (int) – The ID of the shortcut or website.

    Return Type: void

    Limitations: N/A


  1. Command: getCustomPropertyValue(pStrProperty)

    Description: Fetches the value of a custom property that has been set on the device through the SureMDM console.

    https://knowledgebase.42gears.com/article/how-to-define-and-manage-custom-properties-via-suremdm/

    Script:

     \!\#suremdmjs  
    var propertyValue = suremdmjs.getCustomPropertyValue("CustomPropertyKey");

    Parameters: pStrProperty (String) – The key of the custom property to retrieve.

    Return Type: String

    Limitations: N/A


  1. Command: getPropertyValue(pStrProperty)

    Description: Retrieves the value of a specified device property. Supports various wildcards for common device properties like $OSVersion$, $DeviceName$, $SerialNumber$, etc.

    Script:

     \!\#suremdmjs  
    var propertyValue = suremdmjs.getPropertyValue('$OSVersion$');

    Parameters: pStrProperty (String) – The key of the property to retrieve.

    Return Type: String

    Limitations: N/A


  1. Command: getPortraitWallpaper()

    Description: Provides the file path of the portrait wallpaper set on the device.

    Script:

     \!\#suremdmjs  
    var portraitWallpaper = suremdmjs.getPortraitWallpaper();

    Parameters: N/A

    Return Type: String

    Limitations: N/A


  1. Command: getLandscapeWallpaper()

    Description: Provides the file path of the landscape wallpaper set on the device.

    Script:

     \!\#suremdmjs  
    var landscapeWallpaper = suremdmjs.getLandscapeWallpaper();

    Parameters: N/A

    Return Type: String

    Limitations: N/A


  1. Command: getSystemSetting(propertyKey)

    Description: Allows fetching values from Android's Settings.System table. Refer to the link below for a list of system settings keys.

    https://developer.android.com/reference/android/provider/Settings.System

    Script:

     \!\#suremdmjs  
    var systemSetting = suremdmjs.getSystemSetting(propertyKey);

    Parameters: propertyKey (String) – The key of the system setting to retrieve.

    Return Type: String

    Limitations: N/A


  1. Command: getGlobalSetting(propertyKey)

    Description: Allows fetching values from Android's Settings.Global table. Refer to the link below for the list of global settings keys.

    https://developer.android.com/reference/android/provider/Settings.Global

    Script:

     \!\#suremdmjs  
    var globalSetting = suremdmjs.getGlobalSetting(propertyKey);

    Parameters: propertyKey (String) – The key of the global setting to retrieve.

    Return Type: String

    Limitations: N/A Notes:


  1. Command: getSecureSetting(propertyKey)

    Description: Allows fetching values from Android's Settings.Secure table. Refer to the link below for the list of secure settings keys.

    https://developer.android.com/reference/android/provider/Settings.Secure

    Script:

     \!\#suremdmjs  
    var secureSetting = suremdmjs.getSecureSetting(propertyKey);

    Parameters: propertyKey (String) – The key of the secure setting to retrieve.

    Return Type: String

    Limitations: N/A


  1. Command: getAllCustomProperties()

    Description: Fetches all custom properties configured on the device.

    Example:


    [
    {
    "key": "property1",
    "value": "value1",
    "dataType": "String",
    },
    {
    "key": "property2",
    "value": "2",
    "dataType": "Integer",
    }
    ]

    Script:

     \!\#suremdmjs  
    var customProperties = suremdmjs.getAllCustomProperties();

    Parameters: N/A

    Return Type: String

    Limitations: N/A


  1. Command: showDialog(pStrTitle, pStrMessage)

    Description: Displays a dialog box on the device with a specified title and message.

    Script:

     \!\#suremdmjs  
    suremdmjs.showDialog('Info Message','The device will be under maintenance for the next 24 hour');

    Parameters: pStrTitle (String), pStrMessage (String)

    Return Type: void

    Limitations: N/A


  1. Command: executeRunscript(script)

    Description: Executes a runscript on the device.

    Script:

    \!\#suremdmjs  
    var pStrScript = !#suremdm<br/>reboot;
    suremdmjs.executeRunscript(pStrScript);

    Parameters: script (String)

    Return Type: String

    Limitations: N/A


  1. Command: launch(packageName)

    Description: Launches an application by its package name.

    Script:

     \!\#suremdmjs  
    suremdmjs.launch("com.android.chrome”);

    Parameters: packageName (String)

    Return Type: void

    Limitations: N/A


  1. Command: launch(packageName, freshLaunch)

    Description: Launches an application by its package name, with an option for a fresh launch.

    Script:

     \!\#suremdmjs  
    suremdmjs.launch("com.android.chrome", true);

    Parameters: packageName (String), freshLaunch (boolean)

    Return Type: void

    Limitations: N/A


  1. Command: launch(action, category, packageName, className)

    Description: Launches an application using an intent action, category, package name, and class name.

    Script:

    \!\#suremdmjs 
    suremdmjs.launch(
    "android.intent.action.MAIN",
    "android.intent.category.LAUNCHER",
    "Com.android.chrome",
    "com.google.android.apps.chrome.Main"
    );

    Parameters: action (String), category (String), packageName (String), className (String)

    Return Type: void

    Limitations: N/A


  1. Command: launch(action, category, packageName, className, uri)

    Description: Launches an application using an intent action, category, package name, class name, and URI.

    Script:

    \!\#suremdmjs 
    suremdmjs.launch(
    "android.intent.action.MAIN",
    "android.intent.category.LAUNCHER",
    "Com.android.chrome",
    "com.google.android.apps.chrome.Main",
    "https://www.example.com"
    );

    Parameters: action (String), category (String), packageName (String), className (String), uri (String)

    Return Type: void

    Limitations: N/A


  1. Command: createDirectory(pStrPath)

    Description: Creates a new directory at the specified path. Returns true if successful, false otherwise.

    Script:

     \!\#suremdmjs  
    suremdmjs.createDirectory("/sdcard/Download/Test/");

    Parameters: pStrPath (String)

    Return Type: boolean

    Limitations: N/A


  1. Command: exists(pStrPath)

    Description: Checks if a file or directory exists at the specified path. Returns true if it exists, false otherwise.

    Script:

     \!\#suremdmjs  
    suremdmjs.exists("/sdcard/Download/Test/");

    Parameters: pStrPath (String)

    Return Type: boolean

    Limitations: N/A


  2. Command: getLastModified(pStrPath)

    Description: Retrieves the last modified timestamp of a file or directory.

    Script:

     \!\#suremdmjs  
    suremdmjs.getLastModified("/sdcard/Download/Test/");

    Parameters: pStrPath (String)

    Return Type: long

    Limitations: N/A


  1. Command: getFileLength(pStrPath)

    Description: Retrieves the length (size) of a file in bytes.

    Script:

     \!\#suremdmjs  
    suremdmjs.getFileLength("/sdcard/Download/Test/");

    Parameters: pStrPath (String)

    Return Type: long

    Limitations: N/A


  1. Command: canReadFile(pStrPath)

    Description: Checks if the application has read access to the specified file.

    Script:

     \!\#suremdmjs  
    suremdmjs.canReadFile("/sdcard/Download/Test/");

    Parameters: pStrPath (String)

    Return Type: boolean

    Limitations: N/A


  1. Command: createNewFile(pStrPath)

    Description: Creates a new empty file at the specified path.

    Script:

     \!\#suremdmjs  
    suremdmjs.createNewFile("/sdcard/Download/Test.txt");

    Parameters: pStrPath (String)

    Return Type: boolean

    Limitations: N/A


  1. Command: canWriteFile(pStrPath)

    Description: Checks if the application has write access to the specified file.

    Script:

     \!\#suremdmjs  
    suremdmjs.canWriteFile("/sdcard/Download/Test.txt");

    Parameters: pStrPath (String)

    Return Type: boolean

    Limitations: N/A


  1. Command: BatteryInterface->level

    Description: Allows setting up an event listener for changes in the device's battery level.

    Script:

    \!\#suremdmjs 
    suremdmjs.battery().addEventListener("levelchange", "updateBatteryStatus");
    function updateBatteryStatus(batteryLevel) {
    document.querySelector('#battery .value').textContent = batteryLevel;
    }

    Parameters: N/A

    Return Type: void

    Limitations: N/A


  1. Command: BatteryInterface->charging

    Description: Allows setting up an event listener for changes in the device's battery charging state

    Script:

    \!\#suremdmjs 
    suremdmjs.battery().addEventListener("chargingchange", "updateBatteryChargingStatus"); function updateBatteryChargingStatus(batteryChargingStatus) {
    document.querySelector('#batteryChargingStatus .value').textContent = batteryChargingStatus;
    }"

    Parameters: N/A

    Return Type: void

    Limitations: N/A


  1. Command: grantCert(domain, alias)

Description: Grants certificate authentication for the specified domain using the provided alias.

Script:

 \!\#suremdmjs  
#!suremdmjs
suremdmjs.grantCert("example.com", "myCertAlias");

Parameters:

domain (string): The domain name for which certificate authentication should be granted.

alias (string): The alias of the certificate to be associated with the domain.

Return Type: void

Limitations: The domain must be provided in a valid format.


  1. Command: denyCert(domain)

Description: Denies certificate authentication for the specified domain.

Script:

 \!\#suremdmjs  
#!suremdmjs
suremdmjs.denyCert("example.com");

Parameters:

domain (string): The domain name for which certificate authentication should be denied.

Return Type: void

Limitations: Once denied, the domain cannot use certificate-based authentication until explicitly granted again.


  1. Command: clearCert(domain)

Description: Clears the certificate authentication state for the specified domain. This removes any previously granted or denied certificate associations.

Script:

#!suremdmjs  
suremdmjs.clearCert("example.com");

Parameters:

domain (string): The domain name for which the certificate authentication state should be cleared.

Return Type: void

Limitations: N/A