UNPKG

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