title | contributors | |
---|---|---|
Device |
|
The Device
class (singleton) contains information about the current device, such as os
, manufacturer
, uuid
and more.
To use the Device class, import it from @nativescript/core
.
import { Device } from '@nativescript/core'
To check if the device is a phone or tablet, use the deviceType property.
const deviceType: string = Device.deviceType // Phone
const language: string = Device.language // "en"
The device manufacturer is accessed using the manufacturer property.
const manufacturer: string = Device.manufacturer // "Samsung"
const model: string = Device.model
To get the device operating system name, use the os property:
const os: string = Device.os // Android
To access the operating system version of the device, use the osVersion property:
const osVersion: string = Device.osVersion // 13
To get the country or region of the device, use the region property:
const region: string = Device.region // ES
Use the sdkVersion property to get the SDK version:
const sdkVersion: string = Device.sdkVersion // 33
To access the device's universally unique identifier(uuid), use the uuid property:
const uuid: string = Device.uuid // cb83c3347392bfe2
Gets current device type. Available types: "Phone" | "Tablet"
Gets the device language.
Gets the manufacturer of the device.
Gets the model of the device.
Gets the OS of the device.
Gets the OS version.
Gets the device region/country.
Gets the SDK version.
Gets the uuid for the device.
::: warning Note If you need to receive the same uuid after the application is re-installed, consider using a plugin instead. :::