mobicontrol.packages

This namespace provides access to the .pcg (SOTI MobiControl package file) installation functionality.
Since:
  • Version 1.0 (API level 1)

Members

static, readonly InstallationStatusCode :object

This enumeration represents a return status code of mobicontrol.packages.install.
Properties:
Name Type Description
NONE object No specific status code.
FINISHED object Installation was finished programmatically from pre-install script.
FILE_NOT_FOUND object Package file was not found.
OUT_OF_STORAGE object Installation failed because the device does not have enough storage.
PACKAGE_INCOMPATIBLE object Installation failed because of package incompatibility.
ABORTED object Installation was aborted programmatically from pre-install script.
PACKAGE_FORMAT_NOT_CORRECT object The format of the package file is not correct.
APP_VERSION_DOWNGRADE object Attempt to downgrade already installed app failed.
APK_FORMAT_NOT_CORRECT object The format of an .apk file inside the package file is not correct. This includes cases where the .apk file is incompatible with the device's OS.
Since:
  • Version 1.0 (API level 1)

static, readonly Termination :object

This enumeration defines errors which can be thrown to indicate special package installation termination conditions.
Check Throwable APIs tutorial for details.
Properties:
Name Type Description
ABORTED object If thrown from package pre-installation script, aborts the installation of the package and forces it to show up as "Failed" in the Web Console
FINISHED object If thrown from package pre-installation script, skips the installation of the package and forces it to show up as "Successful" in the Web Console
Since:
  • Version 1.5 (API level 6)

Methods

async, static install(filePath, callbackFunctionopt, invocationTimeoutInMillisopt) → {boolean}

Install a package file.
Parameters:
Name Type Attributes Default Description
filePath string The path to the .pcg file.
callbackFunction mobicontrol.packages.installCallback <optional>
JavaScript function which is called when the installation attempt completes.
invocationTimeoutInMillis number <optional>
600000 Invocation timeout in milliseconds. If the callback function isn't invoked before the timeout expires, it will be called with the timed-out result.
Returns:
boolean - true if the package installation process was successfully launched, false otherwise.
Since:
  • Version 1.0 (API level 1)
Example
// Install a package and start the the embedded app as soon as the installation finishes
mobicontrol.packages.install('/sdcard/package1.pcg', onFinish);

function onFinish(result) {
    if (result.isSuccessful) {
        mobicontrol.app.start('net.soti.example');
    }
}

Type Definitions

installCallback(result)

Callback function for mobicontrol.packages.install.
Parameters:
Name Type Description
result object Result of the installation attempt.
Properties
Name Type Description
packageFilename string The .pcg file that is being installed.
statusCode mobicontrol.packages.InstallationStatusCode The detailed status code of the callback.

Follow the link in the Type column to see all the possible values.

isSuccessful boolean Success status of the callback.

true if the callback completed successfully, false otherwise.

isTimedOut boolean Timeout status of the callback.

true if the callback was timed out, false otherwise.

Note: A timeout is considered a failure, so if the timeout status is true, failure status is true as well, and success status is false.

isFailed boolean Failure status of the callback.

true if the callback failed, false otherwise.

Since:
  • Version 1.0 (API level 1)