πŸš€ 8.9 Released! β†’ ⚑️ New Node-API Engine Preview, πŸ“² ns widget ios, πŸ’… Tailwind v4 and more...
Read Announcement

The Device class (singleton) contains information about the current device, such as os, manufacturer, uuid and more.

Using the Device class ​

To use the Device class, import it from @nativescript/core.

ts
import { Device } from'@nativescript/core'

Getting the device type ​

To check if the device is a phone or tablet, use the deviceType property.

ts
constdeviceType:string= Device.deviceType // Phone

Getting the device language ​

ts
constlanguage:string= Device.language // "en"

Getting the device manufacturer ​

The device manufacturer is accessed using the manufacturer property.

ts
constmanufacturer:string= Device.manufacturer // "Samsung"

Getting the device model ​

ts
constmodel:string= Device.model

Getting the device operating system name ​

To get the device operating system name, use the os property:

ts
constos:string= Device.os // Android

Getting the device operating system version ​

To access the operating system version of the device, use the osVersion property:

ts
constosVersion:string= Device.osVersion // 13

Getting the device region ​

To get the country or region of the device, use the region property:

ts
constregion:string= Device.region // ES

Getting the device SDK version ​

Use the sdkVersion property to get the SDK version:

ts
constsdkVersion:string= Device.sdkVersion // 33

Getting the device uuid ​

To access the device's universally unique identifier(uuid), use the uuid property:

ts
constuuid:string= Device.uuid // cb83c3347392bfe2

API ​

deviceType ​

Gets current device type. Available types: "Phone" | "Tablet"


language ​

Gets the device language.


manufacturer ​

Gets the manufacturer of the device.


model ​

Gets the model of the device.


os ​

Gets the OS of the device.


osVersion ​

Gets the OS version.


region ​

Gets the device region/country.


sdkVersion ​

Gets the SDK version.


uuid ​

Gets the uuid for the device.

Note

If you need to receive the same uuid after the application is re-installed, consider using a plugin instead.

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /