Trigger JavaScript Scripts Using Android Legacy Script
Summary
Related SOTI ONE Platform Products
Related Device OS
Process Description
Note: This is a three-part process to trigger Android JavaScript scripts by using an Android legacy script.
Part 1: Create a Package
1. From the SOTI MobiControl the web console, select Packages from the main menu. The Packages view opens.
2. Select the Add a Package button at top-right corner and select Create.
6. Copy and paste the folowing example JavaScript (or other available JavaScript scripts) into the Script Editor and select Save.
#!/usr/bin/env js
mobicontrol.message.createInfoDialog('This JavaScript Script generated from Android Legacy Script').show(); //log message on device screen
7. Select Next and Publish to complete creating a package.
Part 2: Distribute the Package to Android Devices
1. In the SOTI MobiControl web console, navigate to the File Sync section and create a new file sync policy. Select Next to continue.2. Choose Download from Server as the file sync type. In the File Settings section, complete the following fields:
- Server File/Folder Name: Specify the path to your JSON file on the server, for example.,
%ROOT%/MobiControl. - Device File/Folder Name: Specify the destination path on the Android device, e.g.,
%sdcard%/Download/Triggering JavaScript Script from Android Legacy Script_1.0.pcg.
3. Select Next to proceed.
4. Verify that the package is present on your test Android device at the specified path from part 2, step 2: /sdcard/Download/
Part 3: Triggering JavaScript Script from Android Legacy Script
1. Once the package is available on the Android device, you can trigger the JavaScript scripts contained in the package by sending a legacy script to install the package which will trigger the JavaScript script to run.
installpackage %sdcard%/Download/"Triggering JavaScript Script from Android Legacy Script_1.0.pcg"Verification and Validation
Was this helpful?
Thanks for your feedback