Object “device”

Object > NativeObject > Device

Provides information about the device that executes the application.

Constructor private
Singleton device
Namespace tabris
Direct subclasses None
JSX support No

Properties

language

The user language configured on the device as an RFC 4646 compliant string. For example "de", "es-ES", etc. This property is also available globally as navigator.language.

Type string
Settable No

This property can only be set via constructor. Once set, it cannot change anymore.

model

The name of the device model. For example "iPad4,1" or "Nexus 7". This property is also available globally as device.model.

Type string
Settable No

This property can only be set via constructor. Once set, it cannot change anymore.

name

iOS

The name of the device set by owner. For example "John's iPhone". This property is also available globally as device.name.

Type string
Settable No

This property can only be set via constructor. Once set, it cannot change anymore.

orientation

The device orientation. One of portrait-primary, portrait-secondary, landscape-primary, and landscape-secondary.

Type 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary'
Settable No

platform

The name of the platform. Currently either "Android" or "iOS". This property is also available globally as device.platform.

Type 'Android' | 'iOS'
Settable No

This property can only be set via constructor. Once set, it cannot change anymore.

scaleFactor

The ratio between physical pixels and device independent pixels. This property is also available globally as window.devicePixelRatio.

Type number
Settable No

This property can only be set via constructor. Once set, it cannot change anymore.

screenHeight

The entire height of the device’s screen in device independent pixel. Depends on the current device orientation. This property is also available globally as screen.height.

Type number
Settable No

This property can only be set via constructor. Once set, it cannot change anymore.

screenWidth

The entire width of the device’s screen in device independent pixel. Depends on the current device orientation. This property is also available globally as screen.width.

Type number
Settable No

This property can only be set via constructor. Once set, it cannot change anymore.

vendor

The name of the device manufacture. For example "Samsung" or "Apple". This property is also available globally as device.vendor.

Type string
Settable No

This property can only be set via constructor. Once set, it cannot change anymore.

version

The platform version. On iOS it looks like this: "8.1.1". On Android, the version code is returned. This property is also available globally as device.version.

Type string
Settable No

This property can only be set via constructor. Once set, it cannot change anymore.

Change Events

orientationChanged

Fired when the orientation property has changed and the rotation animation has finished.

Parameter Type Description
value string The new value of orientation.