0
# Application Information
1
2
Application metadata including version information, installation details, and app-specific identifiers. Useful for app analytics, version checking, and installation tracking.
3
4
## Capabilities
5
6
### Basic Application Information
7
8
Get basic application metadata and identifiers.
9
10
```typescript { .api }
11
/**
12
* Get application name
13
* @returns Application name string
14
* @platforms Android, iOS, Windows
15
*/
16
function getApplicationName(): string;
17
18
/**
19
* Get bundle identifier
20
* @returns Bundle ID string (e.g., "com.example.app")
21
* @platforms Android, iOS, Windows
22
*/
23
function getBundleId(): string;
24
25
/**
26
* Get application version
27
* @returns Version string (e.g., "1.2.3")
28
* @platforms Android, iOS, Windows
29
*/
30
function getVersion(): string;
31
32
/**
33
* Get build number
34
* @returns Build number string
35
* @platforms Android, iOS, Windows
36
*/
37
function getBuildNumber(): string;
38
39
/**
40
* Get readable version (version + build number)
41
* @returns Combined version and build number
42
* @platforms Android, iOS, Windows
43
*/
44
function getReadableVersion(): string;
45
```
46
47
**Usage Examples:**
48
49
```typescript
50
import {
51
getApplicationName,
52
getBundleId,
53
getVersion,
54
getBuildNumber,
55
getReadableVersion
56
} from 'react-native-device-info';
57
58
// Basic app information
59
const appName = getApplicationName();
60
const bundleId = getBundleId();
61
const version = getVersion();
62
const buildNumber = getBuildNumber();
63
const readableVersion = getReadableVersion();
64
65
console.log(`App: ${appName} (${bundleId})`);
66
console.log(`Version: ${version}`);
67
console.log(`Build: ${buildNumber}`);
68
console.log(`Full Version: ${readableVersion}`);
69
70
// Version checking for updates
71
const currentVersion = version;
72
const minimumSupportedVersion = '1.0.0';
73
const needsUpdate = compareVersions(currentVersion, minimumSupportedVersion) < 0;
74
```
75
76
### Installation Information
77
78
Get information about app installation and updates.
79
80
```typescript { .api }
81
/**
82
* Get first install time (async)
83
* @returns Promise resolving to timestamp of first install
84
* @platforms Android, iOS, Windows
85
*/
86
function getFirstInstallTime(): Promise<number>;
87
88
/**
89
* Get first install time (sync)
90
* @returns Timestamp of first install
91
* @platforms Android, iOS, Windows
92
*/
93
function getFirstInstallTimeSync(): number;
94
95
/**
96
* Get last update time (async)
97
* @returns Promise resolving to timestamp of last update
98
* @platforms Android
99
*/
100
function getLastUpdateTime(): Promise<number>;
101
102
/**
103
* Get last update time (sync)
104
* @returns Timestamp of last update
105
* @platforms Android
106
*/
107
function getLastUpdateTimeSync(): number;
108
109
/**
110
* Get installer package name (async)
111
* @returns Promise resolving to installer package name
112
* @platforms Android, Windows, iOS
113
*/
114
function getInstallerPackageName(): Promise<string>;
115
116
/**
117
* Get installer package name (sync)
118
* @returns Installer package name string
119
* @platforms Android, Windows, iOS
120
*/
121
function getInstallerPackageNameSync(): string;
122
```
123
124
**Usage Examples:**
125
126
```typescript
127
import {
128
getFirstInstallTime,
129
getLastUpdateTime,
130
getInstallerPackageName
131
} from 'react-native-device-info';
132
133
// Installation timing
134
const firstInstall = new Date(await getFirstInstallTime());
135
console.log(`First installed: ${firstInstall.toLocaleDateString()}`);
136
137
if (Platform.OS === 'android') {
138
const lastUpdate = new Date(await getLastUpdateTime());
139
console.log(`Last updated: ${lastUpdate.toLocaleDateString()}`);
140
141
// Check how long since last update
142
const daysSinceUpdate = (Date.now() - await getLastUpdateTime()) / (1000 * 60 * 60 * 24);
143
console.log(`Days since update: ${Math.floor(daysSinceUpdate)}`);
144
}
145
146
// Installation source
147
const installer = await getInstallerPackageName();
148
console.log(`Installed from: ${installer}`);
149
150
// Determine install source
151
const isPlayStoreInstall = installer === 'com.android.vending';
152
const isSideloaded = installer === 'unknown';
153
console.log(`Play Store install: ${isPlayStoreInstall}`);
154
console.log(`Sideloaded: ${isSideloaded}`);
155
```
156
157
### Installation and Referrer Tracking
158
159
Get installation referrer and marketing attribution information.
160
161
```typescript { .api }
162
/**
163
* Get install referrer (async)
164
* @returns Promise resolving to install referrer string
165
* @platforms Android, Windows, Web
166
*/
167
function getInstallReferrer(): Promise<string>;
168
169
/**
170
* Get install referrer (sync)
171
* @returns Install referrer string
172
* @platforms Android, Windows, Web
173
*/
174
function getInstallReferrerSync(): string;
175
```
176
177
**Usage Examples:**
178
179
```typescript
180
import { getInstallReferrer } from 'react-native-device-info';
181
182
// Marketing attribution
183
const referrer = await getInstallReferrer();
184
console.log(`Install referrer: ${referrer}`);
185
186
// Parse referrer for campaign tracking
187
if (referrer && referrer !== 'unknown') {
188
const params = new URLSearchParams(referrer);
189
const utmSource = params.get('utm_source');
190
const utmCampaign = params.get('utm_campaign');
191
192
console.log(`Traffic source: ${utmSource}`);
193
console.log(`Campaign: ${utmCampaign}`);
194
}
195
```
196
197
### App Performance Metrics
198
199
Get app startup and performance timing information.
200
201
```typescript { .api }
202
/**
203
* Get app startup time (async)
204
* @returns Promise resolving to startup time in milliseconds
205
* @platforms Android, iOS
206
*/
207
function getStartupTime(): Promise<number>;
208
209
/**
210
* Get app startup time (sync)
211
* @returns Startup time in milliseconds
212
* @platforms Android, iOS
213
*/
214
function getStartupTimeSync(): number;
215
```
216
217
**Usage Examples:**
218
219
```typescript
220
import { getStartupTime } from 'react-native-device-info';
221
222
// Performance monitoring
223
const startupTime = await getStartupTime();
224
console.log(`App startup time: ${startupTime}ms`);
225
226
// Performance analytics
227
if (startupTime > 5000) {
228
console.warn('Slow startup detected');
229
// Send analytics event for slow startup
230
}
231
232
// Compare with previous launches
233
const averageStartupTime = 3000; // from analytics
234
const isSlowerThanAverage = startupTime > averageStartupTime * 1.5;
235
if (isSlowerThanAverage) {
236
console.log('Startup slower than average');
237
}
238
```
239
240
### User Agent Information
241
242
Get user agent string for web compatibility and analytics.
243
244
```typescript { .api }
245
/**
246
* Get user agent string (async)
247
* @returns Promise resolving to user agent string
248
* @platforms Android, iOS, Web
249
*/
250
function getUserAgent(): Promise<string>;
251
252
/**
253
* Get user agent string (sync)
254
* @returns User agent string
255
* @platforms Android, Web
256
*/
257
function getUserAgentSync(): string;
258
```
259
260
**Usage Examples:**
261
262
```typescript
263
import { getUserAgent, getUserAgentSync } from 'react-native-device-info';
264
265
// Web compatibility
266
const userAgent = await getUserAgent();
267
console.log(`User Agent: ${userAgent}`);
268
269
// Parse user agent for browser detection (Web platform)
270
if (Platform.OS === 'web') {
271
const userAgentSync = getUserAgentSync();
272
const isChrome = userAgentSync.includes('Chrome');
273
const isSafari = userAgentSync.includes('Safari') && !isChrome;
274
const isFirefox = userAgentSync.includes('Firefox');
275
276
console.log(`Browser: ${isChrome ? 'Chrome' : isSafari ? 'Safari' : isFirefox ? 'Firefox' : 'Other'}`);
277
}
278
279
// Analytics tracking
280
const analyticsData = {
281
userAgent,
282
timestamp: Date.now(),
283
platform: Platform.OS
284
};
285
```
286
287
### Display and UI Information
288
289
Get display scaling and font information.
290
291
```typescript { .api }
292
/**
293
* Get font scale factor (async)
294
* @returns Promise resolving to font scale factor
295
* @platforms Android, iOS, Windows
296
*/
297
function getFontScale(): Promise<number>;
298
299
/**
300
* Get font scale factor (sync)
301
* @returns Font scale factor number
302
* @platforms Android, iOS, Windows
303
*/
304
function getFontScaleSync(): number;
305
306
/**
307
* Check if screen is in landscape mode (async)
308
* @returns Promise resolving to true if landscape
309
* @platforms All (uses Dimensions API)
310
*/
311
function isLandscape(): Promise<boolean>;
312
313
/**
314
* Check if screen is in landscape mode (sync)
315
* @returns True if screen is in landscape mode
316
* @platforms All (uses Dimensions API)
317
*/
318
function isLandscapeSync(): boolean;
319
```
320
321
**Usage Examples:**
322
323
```typescript
324
import { getFontScale, isLandscape } from 'react-native-device-info';
325
326
// Accessibility and UI scaling
327
const fontScale = await getFontScale();
328
console.log(`Font scale: ${fontScale}`);
329
330
// Adjust UI for accessibility
331
const isLargeText = fontScale > 1.3;
332
if (isLargeText) {
333
console.log('Large text accessibility setting detected');
334
}
335
336
// Orientation detection
337
const landscape = await isLandscape();
338
console.log(`Landscape mode: ${landscape}`);
339
340
// Responsive design
341
const orientation = landscape ? 'landscape' : 'portrait';
342
console.log(`Current orientation: ${orientation}`);
343
```