Search
Link Search Menu Expand Document
Kony Quantum is now HCL Volt MX. See Revised Terminology. Current Quantum users, see the important note about API naming.

DeviceInfo Object

The DeviceInfo object is a hash table in JavaScript and with the following keys. The following return values are available on all platforms:

  • screenWidth: Specifies the screen width of the device by considering the device orientation at the time of query. The returned value is in device independent pixels (Dp). This attribute is supported in iOS, Android, Windows, and SPA platforms.
  • screenHeight: Specifies the screen height of the device by considering the device orientation at the time of query. The returned value is in device independent pixels (Dp). This attribute is supported in iOS, Android, Windows, and SPA platforms.

Note: The values returned by the screenWidth and screenHeight properties describe the screen space where widgets can be placed using layout parameters. This includes app menu height, headers, and footers, but excludes the screen space occupied by status bar.

Note: The new iPhone retina display contains double the pixels (640) as that of the standard display (320), but iOS treats the resolution as a standard display for measurement and screen output. Websites built for non-retina versions will look very tiny and zoomed out.

  • deviceID: The unique device identifier. The following are the device IDs returned by the platforms:
    • iOS 7 and above: A 32-bit unique ID that is generated by using a private hashed constant and the bundle identifier of the application.

      Note: Due to privacy issues, the MAC address is not used to identify the device. Therefore, instead of using the MAC address, use the identifierForVendor property. For more information on how to use the identifierForVendor property in your app, refer the Base Camp article.

    • From V8 SP4 onwards, the deviceID key is available for Desktop Web and SPA platforms with the following features:
      • If a new device is detected for the same user, you can use deviceID to register the user’s device and map it with the logged-in user in order to perform an action, such as an email alert on new device login or send a push notification.
      • If a user clears the cache, the next time the user launches the web app on the same device, the user is treated as unique. The deviceID value does not persist after cache cleanup.

      • If a user opens two different web apps on the same device, the deviceID value is also different for both the apps.

      • If a user opens a web app in Incognito mode, deviceID continues to work.
    • Android: Returns the unique device identifier. The identifier is a UUID created on the first call to voltmx.os.deviceinfo(). It is saved in the android application preferences and returned as the device_id on subsequent calls. If the UUID is not found (i.e., the app is reinstalled), another UUID is generated, stored in the application preferences, and returned as the new device_id.
  • SERIAL_NO: This API is deprecated. It always returns null.
  • ANDROID_ID: This API is deprecated. It always returns null.
  • uid: This API is deprecated. It always returns null.
  • customdeviceid:

    • For iPhone, a custom device identifier is returned. It internally uses the MAC address of the iOS device and the Bundle Identifier of the application to generate this.

    Note: Due to privacy issues, the MAC address is not used to identify the device. Therefore, instead of using the MAC address, use the identifierForVendor property. For more information on how to use the identifierForVendor property in your app, refer the Base Camp article.

  • identifierForVendor: An alphanumeric string that uniquely identifies a device to the app’s vendor. The value of this property is the same for apps that come from the same vendor running on the same device. A different value is returned for apps on the same device that come from different vendors, and for apps on different devices regardless of vendor.
if (iOS version is less than 6.0){
    	voltmx.os.deviceInfo().customdeviceid
    } else {
    	voltmx.os.deviceInfo().identifierForVendor
    }
    
    
> **_Important:_** This property is applicable only for iOS 6 and above.
  • name: Specifies the name of the platform as iPhone, iPad, Windows Phone, thin client (The name thin client is used for SPA/ Desktop Web / Mobile Web), and Android.
  • model: Specifies the model number of the platform. For example 8900. Not applicable for Mobile Web.
  • version: Specifies the version of the platform in a string format. Not applicable for Mobile Web.
  • deviceWidth: Specifies the device width in pixels. Applicable only on Native App channels and not applicable for Mobile Web.
  • deviceHeight: Specifies the device height in pixels. Applicable only on Native App channels and not applicable for Mobile Web.
  • hasforcetouchsupport: A Boolean value that specifies whether force touch is supported on the device. This value is true if force touch is supported; otherwise, false. Applicable on all platforms.
function isForceTouchAvailble() {
    var deviceInfo = voltmx.os.deviceInfo();
    return deviceInfo.hasforcetouchsupport;
}						
  • hasCamera: A Boolean value that specifies whether the device has a functioning camera. Returns true if the camera is available. This attribute is applicable only for the Responsive Web channel.
var deviceinfo = voltmx.os.deviceInfo();

return deviceinfo.hascamera; // returns true if the camera is available; otherwise returns false.			
  • osName: Specifies the name of the operating system of the device. This attribute is applicable only for the Responsive Web channel.
var deviceinfo = voltmx.os.deviceInfo();

return deviceinfo.osName; // returns the name of the device operating system.			

The possible return values are as follows:

  • constants.DEVICE_OSNAME_ANDROID

  • constants.DEVICE_OSNAME_ANDROIDTABLET

  • constants.DEVICE_OSNAME_IPHONE

  • constants.DEVICE_OSNAME_IPAD

  • constants.DEVICE_OSNAME_MACINTOSH

  • constants.DEVICE_OSNAME_WINDOWS

  • constants.DEVICE_OSNAME_WINDOWSTABLET

  • constants.DEVICE_OSNAME_LINUX

  • osVersion: Specifies the version number of the device’s operating system. This attribute is applicable only for the Responsive Web channel.

var deviceinfo = voltmx.os.deviceInfo();

return deviceinfo.osVersion; // returns the version number of the device OS			

Note: For the Desktop web apps that are accessed from the Linux OS, information about the version of the Linux operating system is not returned when the osVersion property is invoked.

  • APILevel: Provides the Android API Level based on the SDK Version.
function getDeviceAPILevel() {
        var devInfo = voltmx.os.deviceInfo();
        return devInfo.APILevel;
    }
    
The following are the mappings between Android SDK Version and the API Level that is returned:

*   SDK 1.5 - _3_
*   SDK 1.6 - _4_
*   SDK 2.1 - _7_
*   SDK 2.2 - _8_
*   SDK 2.3 - _9_
*   SDK 2.3.3 - _10_
*   SDK 3.0 - _11_
    
    > **_Note:_** The API Level is returned only for Android.
  • For Mobile Web, the following values are returned:
    • type [String] - Specifies if the Mobile Web is Advanced or Basic.
    • category [String] - Provides the Mobile Web category.
      For Advanced Mobile Web, the return value can be iPhone or Android.
    • tcsession [String] - Provides the session ID of the current user.
    • imagecat [String] - Image category based on the device width available in Volt MX Iris Device Database or returns a default value.