UNPKG

2.85 kBTypeScriptView Raw
1/**
2 * Contains all kinds of information about the device, its operating system and software.
3 */
4
5/* tslint:disable:class-name */
6
7/**
8 * Gets a value indicating if the app is running on the Android platform.
9 */
10export const isAndroid: boolean;
11
12/**
13 * Gets a value indicating if the app is running on the iOS platform.
14 */
15export const isIOS: boolean;
16
17/**
18 * Gets a value indicating if the app is running on the iOS platform.
19 */
20export const isVisionOS: boolean;
21
22export * from './common';
23
24/*
25 * An object containing device specific information.
26 */
27export interface IDevice {
28 /**
29 * Gets the manufacturer of the device.
30 * For example: "Apple" or "HTC" or "Samsung".
31 */
32 manufacturer: string;
33
34 /**
35 * Gets the model of the device.
36 * For example: "Nexus 5" or "iPhone".
37 */
38 model: string;
39
40 /**
41 * Gets the OS of the device.
42 * For example: "Android" or "iOS".
43 */
44 os: string;
45
46 /**
47 * Gets the OS version.
48 * For example: 4.4.4(android), 8.1(ios)
49 */
50 osVersion: string;
51
52 /**
53 * Gets the SDK version.
54 * For example: 19(android), 8.1(ios).
55 */
56 sdkVersion: string;
57
58 /**
59 * Gets the type of the current device.
60 * Available values: "Phone", "Tablet".
61 */
62 deviceType: 'Phone' | 'Tablet';
63
64 /**
65 * Gets the uuid.
66 * On iOS this will return a new uuid if the application is re-installed on the device.
67 * If you need to receive the same uuid even after the application has been re-installed on the device,
68 * use this plugin: https://www.npmjs.com/package/nativescript-ios-uuid
69 */
70 uuid: string;
71
72 /**
73 * Gets the preferred language. For example "en" or "en-US".
74 */
75 language: string;
76
77 /**
78 * Gets the preferred region. For example "US".
79 */
80 region: string;
81}
82
83/**
84 * An object containing screen information.
85 */
86export interface ScreenMetrics {
87 /**
88 * Gets the absolute width of the screen in pixels.
89 */
90 widthPixels: number;
91
92 /**
93 * Gets the absolute height of the screen in pixels.
94 */
95 heightPixels: number;
96
97 /**
98 * Gets the absolute width of the screen in density independent pixels.
99 */
100 widthDIPs: number;
101
102 /**
103 * Gets the absolute height of the screen in density independent pixels.
104 */
105 heightDIPs: number;
106
107 /**
108 * The logical density of the display. This is a scaling factor for the Density Independent Pixel unit.
109 */
110 scale: number;
111}
112
113/**
114 * An object describing general information about a display.
115 */
116export class Screen {
117 /**
118 * Gets information about the main screen of the current device.
119 */
120 static mainScreen: ScreenMetrics;
121}
122
123/**
124 * An object describing general information about a display.
125 *
126 * This retains compatibility with NS6
127 */
128export const screen: Screen;
129
130/**
131 * Gets the current device information.
132 */
133export const Device: IDevice;
134
135/**
136 * Gets the current device information.
137 *
138 * This retains compatibility with NS6
139 */
140export const device: IDevice;