Android Plus JavaScript Scripts

Execute more versatile scripts on your Android devices with JavaScript scripts. JavaScript scripts significantly enhance your ability to configure your Android devices by supporting all standard JavaScript language features, including conditional statements, loops, functions, and variables.

JavaScript scripts are supported on all Android Plus devices and use the same mechanisms to target devices as legacy scripts. They are available anywhere you can send scripts, including within rules and profile configurations.

Tip: Use custom APIs to gain developer access to Android device features and make building your scripts easier. Refer to Android Plus JavaScript API Reference for details.
// Enter administrator mode if the device name starts with ‘Headquarters’
if (mobicontrol.device.name.startsWith('Headquarters')) {
 mobicontrol.agent.enterAdminMode();
}
Note: Some script editors (largely those accessed from the legacy console, such as within File Sync policies) do not include the switch that specifies the script type. Start your script with the following shebang line #!/usr/bin/env js to ensure the Android device agent recognizes the script as a JavaScript script.
#!/usr/bin/env js
// Enter administrator mode if the device name starts with ‘Headquarters’
if (mobicontrol.device.name.startsWith('Headquarters')) {
 mobicontrol.agent.enterAdminMode();
}

See JavaScript Samples for some sample scripts that you can adapt for your organization.

Training on the Android Scripting Engine is available at SOTI Learning Academy which is accessible to customers with an active Premium or Enterprise Support entitlement. If you do not have access or would like to gain access, contact your Account Representative.