This namespace provides access to the generic device functionality, like factory resetting or obtaining the device ID.
- Since:
- Version 1.0 (API level 1)
Classes
Members
-
static, readonly id :string
-
Device ID.
- Since:
- Version 1.0 (API level 1)
-
static, readonly InjectKeyStatusCode :object
-
This enumeration represents an error status code of mobicontrol.device.InjectKeyError.
Properties:
Name Type Description UNKNOWN
object The exact error could not be determined. NOT_SUPPORTED
object Key injection is not supported on this device. KEY_NOT_SUPPORTED
object Key code is not supported on this device. - Since:
- Version 1.3 (API level 4)
-
static, readonly, nullable isAirplaneMode :boolean
-
true
if the device is in the airplane mode. This property isfalse
if the device is not in the airplane mode, and isnull
if it cannot be determined whether the device is in the airplane mode.- Since:
- Version 1.2 (API level 3)
-
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 isnull
if the device's hardware MAC address cannot be determined.- Since:
- Version 1.2 (API level 3)
-
static, readonly, nullable manufacturer :string
-
Device manufacturer. This property is
null
if the device manufacturer cannot be determined.- Since:
- Version 1.0 (API level 1)
-
static, readonly, nullable model :string
-
Device model. The end-user-visible name for the end product.
This property isnull
if the device model cannot be determined.- Since:
- Version 1.0 (API level 1)
-
static, readonly name :string
-
Device name.
- Since:
- Version 1.0 (API level 1)
Example
if (mobicontrol.device.name.startsWith('Headquarters')) { mobicontrol.device.reboot(); }
-
static, readonly, nullable serialNumber :string
-
Device serial number. This property is
null
if the device serial number cannot be determined.- Since:
- Version 1.0 (API level 1)
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 -true
if the reset process was successfully launched,false
otherwise.- Since:
- Version 1.0 (API level 1)
-
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 -true
if the reset process was successfully launched,false
otherwise.- Since:
- Version 1.6 (API level 7)
-
static getSystemProperty(key) → nullable {string}
-
Retrieve system property value for a given key.
Parameters:
Name Type Description key
string System property key. Returns:
string - System property value ornull
if such a key doesn't exist, is empty or cannot be determined.- Since:
- Version 1.7 (API level 8)
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 keyCode
number The integer key code of the key to be pressed. Throws:
- Since:
- Version 1.3 (API level 4)
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 -true
if the device was successfully locked,false
otherwise.- Since:
- Version 1.6 (API level 7)
-
static reboot() → {boolean}
-
Reboot the device. The agent notifies the deployment server prior to performing the device reboot.
Returns:
boolean -false
if the device failed to reboot. The function only returns if the device failed to reboot, so it will never returntrue
.- Since:
- Version 1.0 (API level 1)
-
static renameTo(newName)
-
Rename the device.
Parameters:
Name Type Description newName
string New device name, must not be empty. - Since:
- Version 1.5 (API level 6)
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 -true
if the work profile wiping was successfully launched,false
otherwise.- Since:
- Version 1.6 (API level 7)