This namespace provides access to the functionality of the SOTI MobiControl agent, like restarting the agent or the agent's
interaction with the Deployment server.
- Since:
Members
-
static, readonly ConnectionStatusCode :object
-
This enumeration represents a return status code of mobicontrol.agent.connect.
Properties:
Name Type Description NONEobject No specific status code. ALREADY_CONNECTEDobject The agent is already connected. NO_NETWORKobject There are no networks the agent can connect to. This might happen if one of the following conditions exists: - The device is out of the coverage area for any allowed network.
- The device is outside its home network and data roaming has been disabled.
- The device's radio is turned off, for example, because airplane mode is enabled.
SERVER_UNREACHABLEobject The agent cannot establish network connection to the deployment server. SERVER_BUSYobject The network connection to the deployment server was established, but the server didn't acknowledge connection. NOT_CONFIGUREDobject The agent is not configured to connect. - Since:
-
static, readonly Mode :object
-
This enumeration represents an agent mode.
Properties:
Name Type Description ADMIN_MODEobject Administrator mode of the agent. USER_MODEobject User mode of the agent. - Since:
-
static, readonly packageName :string
-
Agent package name.
- Since:
-
static, readonly version :string
-
Agent version name.
- Since:
-
static, readonly versionCode :number
-
Agent version code. This number determines which version is more recent. It has no other meaning than that higher numbers are more recent.
- Since:
Example
var VERSION_KNOWN_TO_HAVE_THE_NEW_FEATURE = 137501042; if (mobicontrol.agent.versionCode >= VERSION_KNOWN_TO_HAVE_THE_NEW_FEATURE) { mobicontrol.log.info("The agent has the new feature!"); }
Methods
-
async, static checkIn()
-
Force the agent to check in with the deployment server.
- Since:
-
async, static connect(callbackFunctionopt, invocationTimeoutInMillisopt) → {boolean}
-
Connect the agent to the deployment server. If the agent is already connected, no action is taken, and the function returns
true. If connection isn't possible, the function returnsfalse. Connection might not be possible if one of the following conditions exists:- The device is out of the coverage area for any allowed network.
- The device is outside its home network and data roaming has been disabled.
- The device's radio is turned off, for example, because airplane mode is enabled.
true, and the connection process is asynchronously launched. Note that the connection might still fail, even if the function has returnedtrue. Note: The agent will try to connect even if its current active network is not allowed by the agent's configuration. If a callback function parameter is supplied, it will be called when the connection attempt completes, with an argument describing the result of the connection attempt.Parameters:
Name Type Attributes Default Description callbackFunctionmobicontrol.agent.connectCallback <optional>
JavaScript function which is called when the connection attempt completes. invocationTimeoutInMillisnumber <optional>
300000 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 -falseif the connection isn't possible,trueotherwise.- Since:
Example
// Provide a callback function with simple logging of successful invocation mobicontrol.agent.connect(onFinish); function onFinish(result) { if (result.isSuccessful) { mobicontrol.log.info('OK'); } if (result.statusCode == mobicontrol.agent.ConnectionStatusCode.ALREADY_CONNECTED) { mobicontrol.log.info('Already connected'); } } -
async, static disconnect() → {boolean}
-
Disconnect the agent from the deployment server.
Returns:
boolean -trueif the disconnection process was successfully launched,falseotherwise.- Since:
-
static enterAdminMode() → {boolean}
-
Enter administrator mode. If the agent is already in the administrator mode, no action is taken, and the function returns
true.Returns:
boolean -falseif the agent failed to enter the administrator mode,trueotherwise.- Since:
-
static enterUserMode() → {boolean}
-
Enter user mode. If the agent is already in the user mode, no action is taken, and the function returns
true.Returns:
boolean -falseif the agent failed to enter the user mode,trueotherwise.- Since:
-
static getCustomAttribute(key) → nullable {string}
-
Retrieve custom attribute value for a given key.
Parameters:
Name Type Description keystring Custom attribute key. Returns:
string - Custom attribute value ornullif such an attribute doesn't exist.- Since:
Example
var myCustomValue = mobicontrol.agent.getCustomAttribute("myCustomKey"); if (myCustomValue != null) { mobicontrol.log.info("Custom attribute for key myCustomKey: " + myCustomValue); } else { mobicontrol.log.info("Custom attribute for key myCustomKey is not found"); } -
static getMode() → {mobicontrol.agent.Mode}
-
Retrieve the current agent mode.
Returns:
mobicontrol.agent.Mode - The current agent mode.- Since:
Example
var agentMode = mobicontrol.agent.getMode(); switch (agentMode) { case mobicontrol.agent.Mode.ADMIN_MODE: mobicontrol.log.info("The agent is in Admin mode"); break; case mobicontrol.agent.Mode.USER_MODE: mobicontrol.log.info("The agent is in User mode"); break; default: mobicontrol.log.error("Unexpected mode: " + agentMode); } -
static isAdminMode() → {boolean}
-
Detect if the agent is in administrator mode.
Returns:
boolean -trueif the agent is in the administrator mode,falseotherwise.- Since:
-
static isUserMode() → {boolean}
-
Detect if the agent is in user mode.
Returns:
boolean -trueif the agent is in the user mode,falseotherwise.- Since:
-
static restart() → {boolean}
-
Restart the agent.
Returns:
boolean -falseif the agent failed to restart. The function only returns if the agent failed to restart, so it will never returntrue.- Since:
-
async, static sendDebugReport() → {boolean}
-
Send a debug report to the deployment server.
Returns:
boolean -trueif the debug report generation process was successfully launched,falseotherwise.- Since:
Type Definitions
-
connectCallback(result)
-
Callback function for mobicontrol.agent.connect.
Parameters:
Name Type Description resultobject Result of the connection attempt. Properties
Name Type Description statusCodemobicontrol.agent.ConnectionStatusCode The detailed status code of the callback. Follow the link in the Type column to see all the possible values. isSuccessfulboolean Success status of the callback. trueif the callback completed successfully,falseotherwise.isTimedOutboolean Timeout status of the callback. trueif the callback was timed out,falseotherwise. Note: A timeout is considered a failure, so if the timeout status istrue, failure status istrueas well, and success status isfalse.isFailedboolean Failure status of the callback. trueif the callback failed,falseotherwise.- Since: