Object “device”

Object > NativeObject > Device

Provides information about the device that executes the application.

Type: Device extends NativeObject
Constructor: private
Singleton: device
Namespace: tabris
Direct subclasses: None
JSX Support: No

See also:

JSX Reading various device properties

Properties

cameras

An array of Camera objects ordered by priority. The first entry is considered the primary camera of the device.

Type: Camera[]
Settable: No
Change Event: Not supported

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. Note: On iOS ≥ 11 it will only return languages declared in CFBundleLocalizations.

Type: string
Settable: No
Change Event: Not supported

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
Change Event: Not supported

name

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

Note: On Android name is only available on Android 7.1+.

Type: string
Settable: No
Change Event: Not supported

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
Change Event: orientationChanged

platform

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

Type: 'Android' | 'iOS'
Settable: No
Change Event: Not supported

scaleFactor

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

Type: number
Settable: No
Change Event: Not supported

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
Change Event: Not supported

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
Change Event: Not supported

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
Change Event: Not supported

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
Change Event: Not supported

Change Events

orientationChanged

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

EventObject Type: PropertyChangedEvent<Device, string>

Property Type Description
value string The new value of orientation.