Skip to content

Device

Provides information about the device.

Reads information about the current device and its screen.

+name

Name identifying the device.

static name(): string

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


+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.

static isPhone(): bool

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


+isPad

Whether the device is a pad.

static isPad(): bool

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


+screenSize

Size of the screen.

static screenSize(): Size

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.


+screenResolution

Resolution of the screen.

static screenResolution(): Size

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


+screenScale

Scale of the screen.

static screenScale(): number

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.


+screenBrightness

Brightness of the screen in percentage.

static screenBrightness(): number

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


+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.

static batteryLevel(): number

The value is in percentage ranging between 0 and 1.


+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.

static preferredLanguages(): [string]

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


+locale

Identifier for the device locale.

static locale(): string

+language

Identifier for the device language.

static language(): string

+isUsingDarkAppearance

Whether the device is using dark appearance.

static isUsingDarkAppearance(): bool

This API is not supported in widgets.


+volume

The device volume.

static volume(): number

The value range from 0 to 1.


+setScreenBrightness

Sets the brightness of the screen.

static setScreenBrightness(percentage: number)

The value range from 0 to 1. To get the screen brightness, refer to the screenBrightness() function.

Parameters

percentage
number
Percentage to set the screen brightness to. Value between 0 and 1.