0
# System Information
1
2
System and operating system information including OS version, build details, and platform-specific system properties. Critical for compatibility checks and platform-specific feature detection.
3
4
## Capabilities
5
6
### Operating System Information
7
8
Get basic operating system information.
9
10
```typescript { .api }
11
/**
12
* Get system/OS name
13
* @returns OS name (e.g., "iOS", "Android", "Windows")
14
* @platforms iOS, Android, Windows
15
*/
16
function getSystemName(): string;
17
18
/**
19
* Get system/OS version
20
* @returns OS version string
21
* @platforms Android, iOS, Windows
22
*/
23
function getSystemVersion(): string;
24
25
/**
26
* Get base OS information (async)
27
* @returns Promise resolving to base OS string
28
* @platforms Android, Web, Windows
29
*/
30
function getBaseOs(): Promise<string>;
31
32
/**
33
* Get base OS information (sync)
34
* @returns Base OS string
35
* @platforms Android, Web, Windows
36
*/
37
function getBaseOsSync(): string;
38
```
39
40
**Usage Examples:**
41
42
```typescript
43
import { getSystemName, getSystemVersion, getBaseOs } from 'react-native-device-info';
44
45
// Basic OS information
46
const osName = getSystemName();
47
const osVersion = getSystemVersion();
48
const baseOs = await getBaseOs();
49
50
console.log(`OS: ${osName} ${osVersion}`);
51
console.log(`Base OS: ${baseOs}`);
52
53
// Version compatibility check
54
const majorVersion = parseInt(osVersion.split('.')[0]);
55
if (osName === 'iOS' && majorVersion >= 14) {
56
console.log('iOS 14+ features available');
57
}
58
```
59
60
### Android API Level
61
62
Android-specific API level information.
63
64
```typescript { .api }
65
/**
66
* Get Android API level (async)
67
* @returns Promise resolving to API level number
68
* @platforms Android
69
*/
70
function getApiLevel(): Promise<number>;
71
72
/**
73
* Get Android API level (sync)
74
* @returns API level number
75
* @platforms Android
76
*/
77
function getApiLevelSync(): number;
78
```
79
80
**Usage Examples:**
81
82
```typescript
83
import { getApiLevel, getApiLevelSync } from 'react-native-device-info';
84
import { Platform } from 'react-native';
85
86
if (Platform.OS === 'android') {
87
// Check API level for feature compatibility
88
const apiLevel = await getApiLevel();
89
console.log(`Android API Level: ${apiLevel}`);
90
91
// Feature gating based on API level
92
if (apiLevel >= 29) {
93
console.log('Android 10+ features available');
94
}
95
96
// Sync version for startup logic
97
const apiLevelSync = getApiLevelSync();
98
}
99
```
100
101
### Build Information
102
103
Detailed build and version information.
104
105
```typescript { .api }
106
/**
107
* Get build ID (async)
108
* @returns Promise resolving to build ID string
109
* @platforms Android, iOS, Windows
110
*/
111
function getBuildId(): Promise<string>;
112
113
/**
114
* Get build ID (sync)
115
* @returns Build ID string
116
* @platforms Android, iOS, Windows
117
*/
118
function getBuildIdSync(): string;
119
```
120
121
**Usage Examples:**
122
123
```typescript
124
import { getBuildId, getBuildIdSync } from 'react-native-device-info';
125
126
// Get build information
127
const buildId = await getBuildId();
128
console.log(`Build ID: ${buildId}`);
129
130
// Sync version
131
const buildIdSync = getBuildIdSync();
132
```
133
134
### Android Build Information
135
136
Detailed Android build information.
137
138
```typescript { .api }
139
/**
140
* Get bootloader version (async)
141
* @returns Promise resolving to bootloader version
142
* @platforms Android
143
*/
144
function getBootloader(): Promise<string>;
145
146
/**
147
* Get bootloader version (sync)
148
* @returns Bootloader version string
149
* @platforms Android
150
*/
151
function getBootloaderSync(): string;
152
153
/**
154
* Get OS codename (async)
155
* @returns Promise resolving to OS codename
156
* @platforms Android
157
*/
158
function getCodename(): Promise<string>;
159
160
/**
161
* Get OS codename (sync)
162
* @returns OS codename string
163
* @platforms Android
164
*/
165
function getCodenameSync(): string;
166
167
/**
168
* Get incremental version (async)
169
* @returns Promise resolving to incremental version
170
* @platforms Android
171
*/
172
function getIncremental(): Promise<string>;
173
174
/**
175
* Get incremental version (sync)
176
* @returns Incremental version string
177
* @platforms Android
178
*/
179
function getIncrementalSync(): string;
180
181
/**
182
* Get preview SDK int (async)
183
* @returns Promise resolving to preview SDK int
184
* @platforms Android
185
*/
186
function getPreviewSdkInt(): Promise<number>;
187
188
/**
189
* Get preview SDK int (sync)
190
* @returns Preview SDK int number
191
* @platforms Android
192
*/
193
function getPreviewSdkIntSync(): number;
194
195
/**
196
* Get security patch level (async)
197
* @returns Promise resolving to security patch level
198
* @platforms Android
199
*/
200
function getSecurityPatch(): Promise<string>;
201
202
/**
203
* Get security patch level (sync)
204
* @returns Security patch level string
205
* @platforms Android
206
*/
207
function getSecurityPatchSync(): string;
208
```
209
210
**Usage Examples:**
211
212
```typescript
213
import {
214
getBootloader,
215
getCodename,
216
getSecurityPatch,
217
getPreviewSdkInt
218
} from 'react-native-device-info';
219
import { Platform } from 'react-native';
220
221
if (Platform.OS === 'android') {
222
// Detailed Android build info
223
const bootloader = await getBootloader();
224
const codename = await getCodename();
225
const securityPatch = await getSecurityPatch();
226
const previewSdk = await getPreviewSdkInt();
227
228
console.log(`Bootloader: ${bootloader}`);
229
console.log(`Codename: ${codename}`);
230
console.log(`Security Patch: ${securityPatch}`);
231
console.log(`Preview SDK: ${previewSdk}`);
232
}
233
```
234
235
### Hardware Information
236
237
Low-level hardware information (primarily Android).
238
239
```typescript { .api }
240
/**
241
* Get device hardware name (async)
242
* @returns Promise resolving to device hardware name
243
* @platforms Android
244
*/
245
function getDevice(): Promise<string>;
246
247
/**
248
* Get device hardware name (sync)
249
* @returns Device hardware name string
250
* @platforms Android
251
*/
252
function getDeviceSync(): string;
253
254
/**
255
* Get display information (async)
256
* @returns Promise resolving to display info
257
* @platforms Android
258
*/
259
function getDisplay(): Promise<string>;
260
261
/**
262
* Get display information (sync)
263
* @returns Display info string
264
* @platforms Android
265
*/
266
function getDisplaySync(): string;
267
268
/**
269
* Get build fingerprint (async)
270
* @returns Promise resolving to build fingerprint
271
* @platforms Android
272
*/
273
function getFingerprint(): Promise<string>;
274
275
/**
276
* Get build fingerprint (sync)
277
* @returns Build fingerprint string
278
* @platforms Android
279
*/
280
function getFingerprintSync(): string;
281
282
/**
283
* Get hardware name (async)
284
* @returns Promise resolving to hardware name
285
* @platforms Android
286
*/
287
function getHardware(): Promise<string>;
288
289
/**
290
* Get hardware name (sync)
291
* @returns Hardware name string
292
* @platforms Android
293
*/
294
function getHardwareSync(): string;
295
296
/**
297
* Get host information (async)
298
* @returns Promise resolving to host info
299
* @platforms Android, Windows
300
*/
301
function getHost(): Promise<string>;
302
303
/**
304
* Get host information (sync)
305
* @returns Host info string
306
* @platforms Android, Windows
307
*/
308
function getHostSync(): string;
309
310
/**
311
* Get product name (async)
312
* @returns Promise resolving to product name
313
* @platforms Android
314
*/
315
function getProduct(): Promise<string>;
316
317
/**
318
* Get product name (sync)
319
* @returns Product name string
320
* @platforms Android
321
*/
322
function getProductSync(): string;
323
324
/**
325
* Get build tags (async)
326
* @returns Promise resolving to build tags
327
* @platforms Android
328
*/
329
function getTags(): Promise<string>;
330
331
/**
332
* Get build tags (sync)
333
* @returns Build tags string
334
* @platforms Android
335
*/
336
function getTagsSync(): string;
337
338
/**
339
* Get build type (async)
340
* @returns Promise resolving to build type
341
* @platforms Android
342
*/
343
function getType(): Promise<string>;
344
345
/**
346
* Get build type (sync)
347
* @returns Build type string
348
* @platforms Android
349
*/
350
function getTypeSync(): string;
351
```
352
353
### Windows-Specific Information
354
355
Windows-specific system information.
356
357
```typescript { .api }
358
/**
359
* Get host names (async)
360
* @returns Promise resolving to array of host names
361
* @platforms Windows
362
*/
363
function getHostNames(): Promise<string[]>;
364
365
/**
366
* Get host names (sync)
367
* @returns Array of host names
368
* @platforms Windows
369
*/
370
function getHostNamesSync(): string[];
371
372
/**
373
* Check if in tablet mode
374
* @returns Promise resolving to true if in tablet mode
375
* @platforms Windows
376
*/
377
function isTabletMode(): Promise<boolean>;
378
```
379
380
**Usage Examples:**
381
382
```typescript
383
import { getHostNames, isTabletMode } from 'react-native-device-info';
384
import { Platform } from 'react-native';
385
386
if (Platform.OS === 'windows') {
387
// Windows-specific information
388
const hostNames = await getHostNames();
389
const inTabletMode = await isTabletMode();
390
391
console.log(`Host Names: ${hostNames.join(', ')}`);
392
console.log(`Tablet Mode: ${inTabletMode}`);
393
}
394
```
395
396
### Platform Features and Support
397
398
Check for platform-specific features and services.
399
400
```typescript { .api }
401
/**
402
* Check for Google Mobile Services (async)
403
* @returns Promise resolving to true if GMS available
404
* @platforms Android
405
*/
406
function hasGms(): Promise<boolean>;
407
408
/**
409
* Check for Google Mobile Services (sync)
410
* @returns True if GMS available
411
* @platforms Android
412
*/
413
function hasGmsSync(): boolean;
414
415
/**
416
* Check for Huawei Mobile Services (async)
417
* @returns Promise resolving to true if HMS available
418
* @platforms Android
419
*/
420
function hasHms(): Promise<boolean>;
421
422
/**
423
* Check for Huawei Mobile Services (sync)
424
* @returns True if HMS available
425
* @platforms Android
426
*/
427
function hasHmsSync(): boolean;
428
429
/**
430
* Check for specific system feature (async)
431
* @param feature - Feature name to check
432
* @returns Promise resolving to true if feature available
433
* @platforms Android
434
*/
435
function hasSystemFeature(feature: string): Promise<boolean>;
436
437
/**
438
* Check for specific system feature (sync)
439
* @param feature - Feature name to check
440
* @returns True if feature available
441
* @platforms Android
442
*/
443
function hasSystemFeatureSync(feature: string): boolean;
444
445
/**
446
* Get all available system features (async)
447
* @returns Promise resolving to array of feature names
448
* @platforms Android
449
*/
450
function getSystemAvailableFeatures(): Promise<string[]>;
451
452
/**
453
* Get all available system features (sync)
454
* @returns Array of feature names
455
* @platforms Android
456
*/
457
function getSystemAvailableFeaturesSync(): string[];
458
```
459
460
**Usage Examples:**
461
462
```typescript
463
import {
464
hasGms,
465
hasHms,
466
hasSystemFeature,
467
getSystemAvailableFeatures
468
} from 'react-native-device-info';
469
import { Platform } from 'react-native';
470
471
if (Platform.OS === 'android') {
472
// Check for mobile services
473
const hasGoogleServices = await hasGms();
474
const hasHuaweiServices = await hasHms();
475
476
console.log(`Google Services: ${hasGoogleServices}`);
477
console.log(`Huawei Services: ${hasHuaweiServices}`);
478
479
// Check for specific features
480
const hasCamera = await hasSystemFeature('android.hardware.camera');
481
const hasNfc = await hasSystemFeature('android.hardware.nfc');
482
483
console.log(`Camera: ${hasCamera}`);
484
console.log(`NFC: ${hasNfc}`);
485
486
// Get all available features
487
const allFeatures = await getSystemAvailableFeatures();
488
console.log(`Available features: ${allFeatures.length}`);
489
}
490
```
491
492
### Architecture and ABI Support
493
494
Get supported architectures and ABIs.
495
496
```typescript { .api }
497
/**
498
* Get supported ABIs (async)
499
* @returns Promise resolving to array of supported ABIs
500
* @platforms Android, iOS, Windows
501
*/
502
function supportedAbis(): Promise<string[]>;
503
504
/**
505
* Get supported ABIs (sync)
506
* @returns Array of supported ABIs
507
* @platforms Android, iOS, Windows
508
*/
509
function supportedAbisSync(): string[];
510
511
/**
512
* Get supported 32-bit ABIs (async)
513
* @returns Promise resolving to array of 32-bit ABIs
514
* @platforms Android
515
*/
516
function supported32BitAbis(): Promise<string[]>;
517
518
/**
519
* Get supported 32-bit ABIs (sync)
520
* @returns Array of 32-bit ABIs
521
* @platforms Android
522
*/
523
function supported32BitAbisSync(): string[];
524
525
/**
526
* Get supported 64-bit ABIs (async)
527
* @returns Promise resolving to array of 64-bit ABIs
528
* @platforms Android
529
*/
530
function supported64BitAbis(): Promise<string[]>;
531
532
/**
533
* Get supported 64-bit ABIs (sync)
534
* @returns Array of 64-bit ABIs
535
* @platforms Android
536
*/
537
function supported64BitAbisSync(): string[];
538
```
539
540
**Usage Examples:**
541
542
```typescript
543
import {
544
supportedAbis,
545
supported32BitAbis,
546
supported64BitAbis
547
} from 'react-native-device-info';
548
549
// Get architecture support
550
const abis = await supportedAbis();
551
console.log(`Supported ABIs: ${abis.join(', ')}`);
552
553
if (Platform.OS === 'android') {
554
const abis32 = await supported32BitAbis();
555
const abis64 = await supported64BitAbis();
556
557
console.log(`32-bit ABIs: ${abis32.join(', ')}`);
558
console.log(`64-bit ABIs: ${abis64.join(', ')}`);
559
560
// Check for 64-bit support
561
const has64BitSupport = abis64.length > 0;
562
console.log(`64-bit support: ${has64BitSupport}`);
563
}
564
```
565
566
### Device State and Orientation
567
568
Get device state and orientation information.
569
570
```typescript { .api }
571
/**
572
* Check if device is in landscape orientation (async)
573
* @returns Promise resolving to true if landscape
574
* @platforms Android, iOS, Windows, Web
575
*/
576
function isLandscape(): Promise<boolean>;
577
578
/**
579
* Check if device is in landscape orientation (sync)
580
* @returns True if landscape orientation
581
* @platforms Android, iOS, Windows, Web
582
*/
583
function isLandscapeSync(): boolean;
584
585
/**
586
* Get font scale factor (async)
587
* @returns Promise resolving to font scale factor
588
* @platforms Android, iOS, Windows
589
*/
590
function getFontScale(): Promise<number>;
591
592
/**
593
* Get font scale factor (sync)
594
* @returns Font scale factor
595
* @platforms Android, iOS, Windows
596
*/
597
function getFontScaleSync(): number;
598
599
/**
600
* Check if PIN or fingerprint is set (async)
601
* @returns Promise resolving to true if security is enabled
602
* @platforms Android, iOS, Windows
603
*/
604
function isPinOrFingerprintSet(): Promise<boolean>;
605
606
/**
607
* Check if PIN or fingerprint is set (sync)
608
* @returns True if security is enabled
609
* @platforms Android, iOS, Windows
610
*/
611
function isPinOrFingerprintSetSync(): boolean;
612
```
613
614
**Usage Examples:**
615
616
```typescript
617
import {
618
isLandscape,
619
getFontScale,
620
isPinOrFingerprintSet
621
} from 'react-native-device-info';
622
623
// Device state information
624
const landscapeMode = await isLandscape();
625
const fontScale = await getFontScale();
626
const hasSecuritySet = await isPinOrFingerprintSet();
627
628
console.log(`Landscape: ${landscapeMode}`);
629
console.log(`Font Scale: ${fontScale}`);
630
console.log(`Security Enabled: ${hasSecuritySet}`);
631
632
// Use for UI adjustments
633
const adjustedFontSize = 16 * fontScale;
634
```
635
636
### Performance and Startup
637
638
Application performance and startup metrics.
639
640
```typescript { .api }
641
/**
642
* Get app startup time (async)
643
* @returns Promise resolving to startup time in milliseconds
644
* @platforms Android, iOS, Windows
645
*/
646
function getStartupTime(): Promise<number>;
647
648
/**
649
* Get app startup time (sync)
650
* @returns Startup time in milliseconds
651
* @platforms Android, iOS, Windows
652
*/
653
function getStartupTimeSync(): number;
654
```
655
656
**Usage Examples:**
657
658
```typescript
659
import { getStartupTime } from 'react-native-device-info';
660
661
// Performance monitoring
662
const startupTime = await getStartupTime();
663
console.log(`App startup time: ${startupTime}ms`);
664
665
// Performance analytics
666
if (startupTime > 3000) {
667
console.log('Slow startup detected');
668
}
669
```
670
671
### User Agent and Web Information
672
673
Get user agent and web-related information.
674
675
```typescript { .api }
676
/**
677
* Get user agent string (async)
678
* @returns Promise resolving to user agent
679
* @platforms Android, iOS, Windows, Web
680
*/
681
function getUserAgent(): Promise<string>;
682
683
/**
684
* Get user agent string (sync)
685
* @returns User agent string
686
* @platforms Android, iOS, Windows, Web
687
*/
688
function getUserAgentSync(): string;
689
```
690
691
**Usage Examples:**
692
693
```typescript
694
import { getUserAgent } from 'react-native-device-info';
695
696
// Web compatibility information
697
const userAgent = await getUserAgent();
698
console.log(`User Agent: ${userAgent}`);
699
700
// Parse for specific capabilities
701
const isWebKit = userAgent.includes('WebKit');
702
const isChrome = userAgent.includes('Chrome');
703
```