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