devices Methods

This section describes the methods exposed by the DevExpress.devices namespace.

current()

Returns information about the current device.

Return Value: Device
An object containing information about the current device.

The device information provided by this function may differ from the actual device on which the application is running if an emulated device is specified for the application (see DevExpress.devices.current(deviceName)). The actual information about the device is available via the DevExpress.devices.real() function.

Show Example:
jQuery
<div data-bind="dxButton: {text: 'Get Platform', clickAction: getPlatform}"></div>
<div class="dx-fieldset">
    <div class="dx-field">
        <div class="dx-field-label">Platform</div>
        <div class="dx-field-value" data-bind="text: platformName"></div>
    </div>
</div>
platformName = ko.observable("undefined");
getPlatform = function () {
  platformName(DevExpress.devices.current().platform);
};
body {
    text-align: center;
}
.button{
    margin-top: 25px;
}

current(deviceName)

Overrides actual device information to force the application to operate as if it was running on the specified device.

Parameters:
deviceName: String|Device
The required device name or an object specifying platform information.

The string values accepted by the input parameter are: "iPhone", "iPhone5", "iPad", "iPadMini", "androidPhone", "androidTablet", "win8", "win8Phone", "msSurface", "tizen", and "desktop". The method can also take on an object containing more detailed information on the current platform.

Show Example:
jQuery
<div data-bind="dxButton: {text: 'Get Platform', clickAction: getPlatform}"></div>
<div class="dx-fieldset">
    <div class="dx-field">
        <div class="dx-field-label">Platform</div>
        <div class="dx-field-value" data-bind="text: platformName"></div>
    </div>
</div>
DevExpress.devices.current("iPhone");
platformName = ko.observable("undefined");
getPlatform = function () {
  platformName(DevExpress.devices.current().platform);
};
body {
    text-align: center;
}
.button{
    margin-top: 25px;
}

orientation()

Returns the current device orientation.

Return Value: String
The "portrait" or "landscape" value specifying device orientation.

real()

Returns real information about the current device regardless of the value passed to the devices.current(deviceName) method.

Return Value: Device
An object containing information about the current device.

Show Example:
jQuery
<div data-bind="dxButton: {text: 'Get Emulated Platform', clickAction: getEmulatedPlatform}"></div>
<div data-bind="dxButton: {text: 'Get Actual Platform', clickAction: getActualPlatform}"></div>
<div class="dx-fieldset">
    <div class="dx-field">
        <div class="dx-field-label">Platform</div>
        <div class="dx-field-value" data-bind="text: platformName"></div>
    </div>
</div>
DevExpress.devices.current("iPhone");
platformName = ko.observable("undefined");
getEmulatedPlatform = function () {
    platformName(DevExpress.devices.current().platform);
};
getActualPlatform = function () {
    platformName(DevExpress.devices.real().platform);
};
body {
    text-align: center;
}
.button{
    margin-top: 25px;
}