Fundamental Concepts
Device
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
.
import { Device } from'@nativescript/core'
Getting the device type β
To check if the device is a phone or tablet, use the deviceType property.
constdeviceType:string= Device.deviceType // Phone
Getting the device language β
constlanguage:string= Device.language // "en"
Getting the device manufacturer β
The device manufacturer is accessed using the manufacturer property.
constmanufacturer:string= Device.manufacturer // "Samsung"
Getting the device model β
constmodel:string= Device.model
Getting the device operating system name β
To get the device operating system name, use the os property:
constos:string= Device.os // Android
Getting the device operating system version β
To access the operating system version of the device, use the osVersion property:
constosVersion:string= Device.osVersion // 13
Getting the device region β
To get the country or region of the device, use the region property:
constregion:string= Device.region // ES
Getting the device SDK version β
Use the sdkVersion property to get the SDK version:
constsdkVersion:string= Device.sdkVersion // 33
Getting the device uuid β
To access the device's universally unique identifier(uuid), use the uuid property:
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.
- Previous
- Connectivity
- Next
- FileSystem