0
# Device Identification
1
2
Core device identification functionality for retrieving unique identifiers, device details, and hardware information. Essential for analytics, device tracking, and platform-specific behavior.
3
4
## Capabilities
5
6
### Unique Identifiers
7
8
Get unique device identifiers for tracking and analytics purposes.
9
10
```typescript { .api }
11
/**
12
* Get unique device identifier (async)
13
* @returns Promise resolving to unique device ID string
14
* @platforms Android, iOS, Windows
15
*/
16
function getUniqueId(): Promise<string>;
17
18
/**
19
* Get unique device identifier (sync)
20
* @returns Unique device ID string
21
* @platforms Android, iOS, Windows
22
*/
23
function getUniqueIdSync(): string;
24
25
/**
26
* iOS-specific method to sync unique ID
27
* @returns Promise resolving to unique ID
28
* @platforms iOS
29
*/
30
function syncUniqueId(): Promise<string>;
31
32
/**
33
* Get device identifier
34
* @returns Device identifier string
35
* @platforms Android, iOS, Windows
36
*/
37
function getDeviceId(): string;
38
```
39
40
**Usage Examples:**
41
42
```typescript
43
import { getUniqueId, getUniqueIdSync, getDeviceId } from 'react-native-device-info';
44
45
// Async approach
46
const uniqueId = await getUniqueId();
47
console.log('Unique ID:', uniqueId);
48
49
// Sync approach (faster for app startup)
50
const uniqueIdSync = getUniqueIdSync();
51
console.log('Unique ID (sync):', uniqueIdSync);
52
53
// Device ID (always sync)
54
const deviceId = getDeviceId();
55
console.log('Device ID:', deviceId);
56
```
57
58
### Android-Specific Identifiers
59
60
Android-specific device identifiers.
61
62
```typescript { .api }
63
/**
64
* Get Android ID (async)
65
* @returns Promise resolving to Android ID
66
* @platforms Android
67
*/
68
function getAndroidId(): Promise<string>;
69
70
/**
71
* Get Android ID (sync)
72
* @returns Android ID string
73
* @platforms Android
74
*/
75
function getAndroidIdSync(): string;
76
77
/**
78
* Get instance ID (async)
79
* @returns Promise resolving to instance ID
80
* @platforms Android
81
*/
82
function getInstanceId(): Promise<string>;
83
84
/**
85
* Get instance ID (sync)
86
* @returns Instance ID string
87
* @platforms Android
88
*/
89
function getInstanceIdSync(): string;
90
91
/**
92
* Get device serial number (async)
93
* @returns Promise resolving to serial number
94
* @platforms Android, Windows
95
*/
96
function getSerialNumber(): Promise<string>;
97
98
/**
99
* Get device serial number (sync)
100
* @returns Serial number string
101
* @platforms Android, Windows
102
*/
103
function getSerialNumberSync(): string;
104
```
105
106
### Device Information
107
108
Basic device information including model, brand, and manufacturer.
109
110
```typescript { .api }
111
/**
112
* Get device model
113
* @returns Device model string
114
* @platforms iOS, Android, Windows
115
*/
116
function getModel(): string;
117
118
/**
119
* Get device brand
120
* @returns Device brand string
121
* @platforms Android, iOS, Windows
122
*/
123
function getBrand(): string;
124
125
/**
126
* Get device manufacturer (async)
127
* @returns Promise resolving to manufacturer name
128
* @platforms Android, iOS, Windows
129
*/
130
function getManufacturer(): Promise<string>;
131
132
/**
133
* Get device manufacturer (sync)
134
* @returns Manufacturer name string
135
* @platforms Android, iOS, Windows
136
*/
137
function getManufacturerSync(): string;
138
139
/**
140
* Get device name (async)
141
* @returns Promise resolving to device name
142
* @platforms Android, iOS, Windows
143
*/
144
function getDeviceName(): Promise<string>;
145
146
/**
147
* Get device name (sync)
148
* @returns Device name string
149
* @platforms Android, iOS, Windows
150
*/
151
function getDeviceNameSync(): string;
152
```
153
154
**Usage Examples:**
155
156
```typescript
157
import {
158
getModel,
159
getBrand,
160
getManufacturer,
161
getDeviceName
162
} from 'react-native-device-info';
163
164
// Get basic device info
165
const model = getModel();
166
const brand = getBrand();
167
const manufacturer = await getManufacturer();
168
const deviceName = await getDeviceName();
169
170
console.log(`Device: ${brand} ${model}`);
171
console.log(`Manufacturer: ${manufacturer}`);
172
console.log(`Device Name: ${deviceName}`);
173
```
174
175
### Device Type and Capabilities
176
177
Determine device type and basic capabilities.
178
179
```typescript { .api }
180
/**
181
* Get device type
182
* @returns Device type string
183
* @platforms Android, iOS, Windows
184
*/
185
function getDeviceType(): string;
186
187
/**
188
* Get device type (sync version)
189
* @returns Device type string
190
* @platforms Android, iOS, Windows
191
*/
192
function getDeviceTypeSync(): string;
193
194
/**
195
* Check if device is a tablet
196
* @returns True if device is a tablet
197
* @platforms Android, iOS, Windows
198
*/
199
function isTablet(): boolean;
200
201
/**
202
* Check if running on emulator (async)
203
* @returns Promise resolving to true if emulator
204
* @platforms Android, iOS, Windows
205
*/
206
function isEmulator(): Promise<boolean>;
207
208
/**
209
* Check if running on emulator (sync)
210
* @returns True if running on emulator
211
* @platforms Android, iOS, Windows
212
*/
213
function isEmulatorSync(): boolean;
214
215
/**
216
* Check if device is low RAM device
217
* @returns True if device has low RAM
218
* @platforms Android
219
*/
220
function isLowRamDevice(): boolean;
221
222
/**
223
* Check if display is zoomed
224
* @returns True if display is zoomed
225
* @platforms iOS
226
*/
227
function isDisplayZoomed(): boolean;
228
```
229
230
**Usage Examples:**
231
232
```typescript
233
import {
234
getDeviceType,
235
isTablet,
236
isEmulator,
237
isLowRamDevice
238
} from 'react-native-device-info';
239
240
// Device type detection
241
const deviceType = getDeviceType();
242
const isTabletDevice = isTablet();
243
const isEmulatorDevice = await isEmulator();
244
245
console.log(`Device Type: ${deviceType}`);
246
console.log(`Is Tablet: ${isTabletDevice}`);
247
console.log(`Is Emulator: ${isEmulatorDevice}`);
248
249
// Platform-specific checks
250
if (Platform.OS === 'android') {
251
const isLowRam = isLowRamDevice();
252
console.log(`Low RAM Device: ${isLowRam}`);
253
}
254
```
255
256
### Physical Design Features
257
258
Check for physical design features like notches and dynamic islands.
259
260
```typescript { .api }
261
/**
262
* Check if device has a notch
263
* @returns True if device has a notch
264
* @platforms All (uses device database)
265
*/
266
function hasNotch(): boolean;
267
268
/**
269
* Check if device has dynamic island
270
* @returns True if device has dynamic island
271
* @platforms All (uses device database)
272
*/
273
function hasDynamicIsland(): boolean;
274
```
275
276
**Usage Examples:**
277
278
```typescript
279
import { hasNotch, hasDynamicIsland } from 'react-native-device-info';
280
281
// Physical design features
282
const deviceHasNotch = hasNotch();
283
const deviceHasDynamicIsland = hasDynamicIsland();
284
285
console.log(`Has Notch: ${deviceHasNotch}`);
286
console.log(`Has Dynamic Island: ${deviceHasDynamicIsland}`);
287
288
// Use for UI adjustments
289
const topSafeAreaAdjustment = deviceHasNotch || deviceHasDynamicIsland ? 44 : 20;
290
```
291
292
### iOS-Specific Features
293
294
iOS-specific device identification features.
295
296
```typescript { .api }
297
/**
298
* Get device token for push notifications
299
* @returns Promise resolving to device token
300
* @platforms iOS
301
*/
302
function getDeviceToken(): Promise<string>;
303
```
304
305
**Usage Examples:**
306
307
```typescript
308
import { getDeviceToken } from 'react-native-device-info';
309
import { Platform } from 'react-native';
310
311
// iOS device token for push notifications
312
if (Platform.OS === 'ios') {
313
const deviceToken = await getDeviceToken();
314
console.log('Device Token:', deviceToken);
315
}
316
```
317
318
## Types
319
320
```typescript { .api }
321
type DeviceType = 'Handset' | 'Tablet' | 'Tv' | 'Desktop' | 'GamingConsole' | 'unknown';
322
```