Utilities
ensemble.device

Device

Ensemble provides convenient access to device information and capabilities. This includes device information, such as the device model, operating system, and screen size.

Access these properties/methods with the prefix ensemble.device.*.

Media Query

Ensemble uses logical pixels, which are based on the device's screen density. This allows for a consistent user interface across different devices.

Properties

Property NameDescription
widthReturns the width of the device's screen in logical pixels.
heightReturns the height of the device's screen in logical pixels.
safeAreaTopReturns the height of the screen's safe area at the top (e.g., iPhone's notch) in logical pixels. This value will be 0 if it is not applicable. You can use this to avoid placing important UI elements in this safe area.
safeAreaBottomReturns the height of the screen's safe area at the bottom (e.g., iPhone's home swiper) in logical pixels. This value will be 0 if it is not applicable. For more detailed information on how to use it with example, Click here.

Capabilities

This table outlines the capabilities related to device notifications and location tracking

Property NameDescription
deviceTokenIf notification is enabled, returns the latest device token that can be used to send push notifications to this device.
lastLocation.latitudeReturns the latitude of the last known location of the device. This value will only be populated if the action getLocation has been used previously and the user has granted location permission to the app.
lastLocation.longitudeReturns the longitude of the last known location of the device. This value will only be populated if the action getLocation has been used previously and the user has granted location permission to the app.

Platform

Ensemble offers utilities/getters for platform-specific logic.

Properties

Property NameDescription
platformReturns the platform name the app is running on. Possible values are ios, android, web, macos, windows, and other.
isIOS()Returns true if the app is running on an iOS device, otherwise false.
isAndroid()Returns true if the app is running on an Android device, otherwise false.
isWeb()Returns true if the app is running on a web browser, otherwise false.
isMacOS()Returns true if the app is running on a macOS device, otherwise false.
isWindows()Returns true if the app is running on a Windows device, otherwise false.

Web

When running on the Web platform, the following properties provide browser information.

Properties

Property NameDescription
browserInfo.browserNameThe name of the browser.
browserInfo.appCodeNameThe internal "code" name of the current browser.
browserInfo.appNameThe official name of the browser.
browserInfo.appVersionThe version of the browser as a DOMString.
browserInfo.deviceMemoryThe amount of device memory in gigabytes. This value is an approximation given by rounding to the nearest power of 2 and dividing that number by 1024.
browserInfo.languageA DOMString representing the preferred language of the user, usually the language of the browser UI. The null value is returned when this is unknown.
browserInfo.languagesAn array of DOMString representing the languages known to the user, by order of preference.
browserInfo.platformThe version of the browser as a DOMString.
browserInfo.productAlways returns 'Gecko', on any browser.
browserInfo.productSubThe build number of the current browser.
browserInfo.userAgentThe sub-version number of the current browser (e.g., "20060909").
browserInfo.vendorThe vendor name of the current browser.
browserInfo.vendorSubReturns the vendor version number (e.g. "6.1").
browserInfo.hardwareConcurrencyThe number of logical processor cores available.
browserInfo.maxTouchPointsThe maximum number of simultaneous touch contact points supported by the current device.

Android

For Android devices, additional specific properties are available.

Properties

PropertyDescription
androidInfo.versionReleaseThe release version of the Android operating system.
androidInfo.versionSdkIntThe API level of the Android operating system.
androidInfo.versionCodenameThe code name of the Android version.
androidInfo.versionIncrementalThe incremental version string of the Android build.
androidInfo.versionPreviewSdkIntThe SDK version of the Android preview.
androidInfo.versionSecurityPatchThe date of the latest security patch level.
androidInfo.boardThe name of the underlying board, like "goldfish".
androidInfo.bootloaderThe system bootloader version number.
androidInfo.brandThe consumer-visible brand with which the product/hardware will be associated, if any.
androidInfo.deviceThe name of the industrial design.
androidInfo.displayA build ID string meant for displaying to the user.
androidInfo.fingerprintA string that uniquely identifies this build.
androidInfo.hardwareThe name of the hardware (from the kernel command line or /proc).
androidInfo.hostThe build host of the Android operating system.
androidInfo.idEither a changelist number, or a label like "M4-rc20". The unique ID of the device.
androidInfo.manufacturerThe manufacturer of the product/hardware.
androidInfo.modelThe end-user-visible name for the end product.
androidInfo.productThe name of the overall product.
androidInfo.tagsComma-separated tags describing the build, like "unsigned,debug".
androidInfo.typeThe type of build, like "user" or "eng".
androidInfo.isPhysicalDevicefalse if the application is running in an emulator, true otherwise.
androidInfo.serialNumberHardware serial number of the device, if available.

iOS

For iOS devices, specific properties can be accessed.

Properties

PropertyDescription
iosInfo.nameDevice name. On iOS < 16 returns user-assigned device name. On iOS >= 16 returns a generic name. More info (opens in a new tab)
iosInfo.systemNameThe name of the current operating system. More info (opens in a new tab)
iosInfo.systemVersionThe current operating system version. More info (opens in a new tab)
iosInfo.modelDevice model. More info (opens in a new tab)
iosInfo.localizedModelLocalized name of the device model. More info (opens in a new tab)
iosInfo.identifierForVendorUnique UUID value identifying the current device. More info (opens in a new tab)
iosInfo.isPhysicalDevicefalse if the application is running in a simulator, true otherwise.
iosInfo.utsnameSysnameOperating system name. More info (opens in a new tab)
iosInfo.utsnameNodenameName of the node within an implementation-dependent communications network. More info (opens in a new tab)
iosInfo.utsnameReleaseRelease level. More info (opens in a new tab)
iosInfo.utsnameVersionVersion level. More info (opens in a new tab)
iosInfo.utsnameMachineHardware type (e.g., 'iPhone7,1' for iPhone 6 Plus). More info (opens in a new tab)

macOS

For macOS devices, the following properties are available.

Properties

Property NameDescription
macOsInfo.computerNameName given to the local machine.
macOsInfo.hostNameOperating system type.
macOsInfo.archMachine CPU architecture. Note that on Apple Silicon Macs, it may return x86_64 if the app runs via Rosetta.
macOsInfo.modelThe model of the device.
macOsInfo.kernelVersionMachine Kernel version. Examples include Darwin Kernel Version 15.3.0 or Darwin Kernel Version 15.0.0.
macOsInfo.osReleaseThe release version of the operating system.
macOsInfo.majorVersionThe major release number, such as 10 in version 10.9.3.
macOsInfo.minorVersionThe minor release number, such as 9 in version 10.9.3.
macOsInfo.patchVersionThe update release number, such as 3 in version 10.9.3.
macOsInfo.activeCPUsNumber of active CPUs.
macOsInfo.memorySizeThe size of the memory
macOsInfo.cpuFrequencyDevice CPU frequency.
macOsInfo.systemGUIDThe GUID of the system.

Windows

For Windows devices, the following properties are available.

Properties

Property NameDescription
windowsInfo.computerNameThe computer's fully-qualified DNS name, where available.
windowsInfo.numberOfCoresNumber of CPU cores on the local machine.
windowsInfo.systemMemoryInMegabytesThe physically installed memory in the computer. This may not be the same as available memory.
windowsInfo.userNameThe user name of the currently logged-in user.
windowsInfo.majorVersionThe major version number of the operating system. For example, for Windows 2000, the major version number is five.
windowsInfo.minorVersionThe minor version number of the operating system. For example, for Windows 2000, the minor version number is zero.
windowsInfo.buildNumberThe build number of the operating system. For example, 22000 or greater for Windows 11.
windowsInfo.platformIdThe operating system platform identifier. For Win32 on NT-based operating systems, RtlGetVersion returns the value VER_PLATFORM_WIN32_NT.
windowsInfo.buildLabValue of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\BuildLab registry key. For example: 22000.co_release.210604-1628.
windowsInfo.buildLabExValue of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\BuildLabEx registry key. For example: 22000.1.amd64fre.co_release.210604-1628.
windowsInfo.productIdDisplayed as "Product ID" in Windows Settings. Value of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductId registry key. For example: 00000-00000-0000-AAAAA.
windowsInfo.productNameValue of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName registry key. For example: Windows 10 Home Single Language.
windowsInfo.releaseIdValue of the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ReleaseId registry key. For example: 1903.
windowsInfo.deviceIdDisplayed as "Device ID" in Windows Settings. Value of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SQMClient\MachineId registry key.