Skip to content

Device

Provides information about the device.

Reads information about the current device and its screen.

+name

Name identifying the device.

You can find and edit the name of your device in the system settings.

static name(): string

+systemName

Name of the operating system:

static systemName(): string

+systemVersion

Version of the operating system.

static systemVersion(): string

+model

Model of the device, e.g. "iPhone".

static model(): string

+isPhone

Whether the device is a phone.

You can use this property to choose behaviour of a script depending on whether its running on a phone or a pad.

static isPhone(): bool

+isPad

Whether the device is a pad.

You can use this property to choose behaviour of a script depending on whether its running on a phone or a pad.

static isPad(): bool

+screenSize

Size of the screen.

The value is measured in points. For an explanation of the relationship between points and pixels, see the documentation of the screenScale() method. The value takes the device rotation into account, so the value will vary between portrait and landscape.

static screenSize(): Size

+screenResolution

Resolution of the screen.

The value is measured in pixels. The value does not take the rotation of the deviec into account.

static screenResolution(): Size

+screenScale

Scale of the screen.

Standard resolution displays have a scale of 1.0 where one point on the screen equals one pixel. Retina displays will have a scale factor of 2.0 or 3.0 where one point on the screen is four or nine pixels, respectively.

static screenScale(): number

+screenBrightness

Brightness of the screen in percentage.

The value range from 0 to 1. To set the screen brightness, refer to setScreenBrightness()

static screenBrightness(): number

+isInPortrait

Whether the device is in portrait with the home button or home indicator at the bottom.

static isInPortrait(): bool

+isInPortraitUpsideDown

Whether the device is in portrait but upside down with the home button or home indicator at the top.

static isInPortraitUpsideDown(): bool

+isInLandscapeLeft

Whether the device is in landscape with the home button or home indicator on the right side.

static isInLandscapeLeft(): bool

+isInLandscapeRight

Whether the device is in landscape with the home button or home indicator on the left side.

static isInLandscapeRight(): bool

+isFaceUp

Whether the device is lying parallel to the ground with the screen facing upwards.

static isFaceUp(): bool

+isFaceDown

Whether the device is lying parallel to the ground with the screen facing downwards.

static isFaceDown(): bool

+batteryLevel

Current battery level.

The value is in percentage ranging between 0 and 1.

static batteryLevel(): number

+isDischarging

Whether the device is being not plugged into power and thus discharging.

static isDischarging(): bool

+isCharging

Whether the device is being charged.

static isCharging(): bool

+isFullyCharged

Whether the device is fully charged.

static isFullyCharged(): bool

+preferredLanguages

The preferred langauges.

The list is ordered according to the language preferences specified in the system settings.

static preferredLanguages(): [string]

+locale

Identifier for the device locale.

static locale(): string

+language

Identifier for the device language.

static language(): string

+setScreenBrightness

Sets the brightness of the screen.

The value range from 0 to 1. To set the screen brightness, refer to setScreenBrightness()

static setScreenBrightness(percentage: number)