This namespace provides access to the generic device functionality, like factory resetting or obtaining the device ID.
- Since:
Classes
Members
-
static, readonly id :string
-
Device ID.
- Since:
-
static, readonly InjectKeyStatusCode :object
-
This enumeration represents an error status code of mobicontrol.device.InjectKeyError.
Properties:
Name Type Description UNKNOWNobject The exact error could not be determined. NOT_SUPPORTEDobject Key injection is not supported on this device. KEY_NOT_SUPPORTEDobject Key code is not supported on this device. - Since:
-
static, readonly, nullable isAirplaneMode :boolean
-
trueif the device is in the airplane mode. This property isfalseif the device is not in the airplane mode, and isnullif it cannot be determined whether the device is in the airplane mode.- Since:
-
static, readonly, nullable macAddress :string
-
The device's hardware MAC address. The returned MAC address might not be the one the device uses to connect to Wi-Fi or other networks. It should be used only for inventory management. MAC addresses used for scanning and connecting to Wi-Fi and other networks are randomized by default on Android 10+.
This property isnullif the device's hardware MAC address cannot be determined.- Since:
-
static, readonly, nullable manufacturer :string
-
Device manufacturer. This property is
nullif the device manufacturer cannot be determined.- Since:
-
static, readonly, nullable model :string
-
Device model. The end-user-visible name for the end product.
This property isnullif the device model cannot be determined.- Since:
-
static, readonly name :string
-
Device name.
- Since:
Example
if (mobicontrol.device.name.startsWith('Headquarters')) { mobicontrol.device.reboot(); } -
static, readonly, nullable serialNumber :string
-
Device serial number. This property is
nullif the device serial number cannot be determined.- Since:
Methods
-
async, static factoryReset() → {boolean}
-
Factory reset the device. The agent notifies the deployment server prior to performing the factory reset. Note: The factory reset will be performed even if the agent is configured with the "disable factory reset" feature control.
Returns:
boolean -trueif the reset process was successfully launched,falseotherwise.- Since:
-
async, static factoryResetWithProtectionData() → {boolean}
-
Factory reset the device with protection data. The agent notifies the deployment server prior to performing the factory reset. Note: The factory reset will be performed even if the agent is configured with the "disable factory reset" feature control.
Returns:
boolean -trueif the reset process was successfully launched,falseotherwise.- Since:
-
static getSystemProperty(key) → nullable {string}
-
Retrieve system property value for a given key.
Parameters:
Name Type Description keystring System property key. Returns:
string - System property value ornullif such a key doesn't exist, is empty or cannot be determined.- Since:
Example
var propertyValue = mobicontrol.device.getSystemProperty("ro.version.sunmi_versioncode"); if (propertyValue != null) { mobicontrol.log.info("System property value for the key: " + propertyValue); } else { mobicontrol.log.info("System property value for the key is not found!"); } -
async, static injectKey(keyCode)
-
Inject the specified key press into the device. This function can be used to press any key on the device (including hardware buttons and soft keyboard keys). The complete list of available key codes can be found at https://developer.android.com/reference/android/view/KeyEvent.
Parameters:
Name Type Description keyCodenumber The integer key code of the key to be pressed. Throws:
- Since:
Example
mobicontrol.device.injectKey(24); // press the VOLUME UP key mobicontrol.device.injectKey(66); // press the ENTER key -
static lock() → {boolean}
-
Lock the device.
Returns:
boolean -trueif the device was successfully locked,falseotherwise.- Since:
-
static reboot() → {boolean}
-
Reboot the device. The agent notifies the deployment server prior to performing the device reboot.
Returns:
boolean -falseif the device failed to reboot. The function only returns if the device failed to reboot, so it will never returntrue.- Since:
-
static renameTo(newName)
-
Rename the device.
Parameters:
Name Type Description newNamestring New device name, must not be empty. - Since:
Example
mobicontrol.device.renameTo("HQ 73"); -
async, static wipeWorkProfile() → {boolean}
-
Wipe the work profile. The agent notifies the deployment server prior to performing the work profile wiping. Note: The work profile wiping will be performed even if the agent is configured with the "disable factory reset" feature control.
Returns:
boolean -trueif the work profile wiping was successfully launched,falseotherwise.- Since: