Registry / web-framework / react-native-device-info

react-native-device-info

JSON →
library15.0.2jsnpmunverified

react-native-device-info is a comprehensive library for React Native applications that provides access to various device-specific information across iOS, Android, and Windows platforms. It allows developers to retrieve details such as device unique ID, brand, model, OS version, system name, application build number, and more. The current stable version is 15.0.2, released in early 2026. The package maintains a frequent release cadence, often issuing multiple patch and minor versions monthly, with major versions typically arriving a few times a year, indicating active development and timely updates for new device capabilities and platform changes. Its key differentiators include broad platform support, a rich API covering a wide range of device properties, and a commitment to keeping up with the latest React Native and platform SDK versions, which sometimes introduces breaking changes related to compilation targets or permissions.

npm install react-native-device-info
INSTALL
IMPORT
SIG · REACT-NATIVE-DEVIC
R
react-native-device-info
web-frameworkjavascriptv15.0.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DeviceInfo
import DeviceInfo from 'react-native-device-info';
import { DeviceInfo } from 'react-native-device-info';
This is the default export for the full API surface, commonly used for accessing multiple methods or for quick access.
getUniqueId
import { getUniqueId } from 'react-native-device-info';
import DeviceInfo from 'react-native-device-info'; const getUniqueId = DeviceInfo.getUniqueId;
Use named imports for individual functions to leverage tree-shaking and improve bundle size, especially if only a few functions are needed.
getManufacturer
import { getManufacturer } from 'react-native-device-info';
const { getManufacturer } = require('react-native-device-info');
While CommonJS `require` might work in some older React Native setups, ES module `import` syntax is the idiomatic and recommended approach in modern React Native projects.
DeviceType
import type { DeviceType } from 'react-native-device-info';
TypeScript users should import types separately for type checking, enhancing code reliability.

This React Native component demonstrates how to fetch and display various device and application details using `react-native-device-info`'s named and default exports. It fetches asynchronous details like unique ID and manufacturer, along with synchronous details like system name, and renders them in a simple UI.

import DeviceInfo, { getUniqueId, getManufacturer, getSystemName, getSystemVersion, isTablet, getApplicationName, getVersion, getBuildNumber } from 'react-native-device-info'; import { View, Text, StyleSheet } from 'react-native'; import React from 'react'; const App = () => { const [deviceDetails, setDeviceDetails] = React.useState({}); React.useEffect(() => { async function fetchDeviceInfo() { const uniqueId = await getUniqueId(); const manufacturer = await getManufacturer(); const systemName = getSystemName(); const systemVersion = getSystemVersion(); const isTabletDevice = isTablet(); const appName = getApplicationName(); const appVersion = getVersion(); const buildNumber = getBuildNumber(); setDeviceDetails({ uniqueId, manufacturer, systemName, systemVersion, isTablet: isTabletDevice, appName, appVersion, buildNumber, deviceBrand: DeviceInfo.getBrand(), model: DeviceInfo.getModel(), hasNotch: DeviceInfo.hasNotch(), }); } fetchDeviceInfo(); }, []); return ( <View style={styles.container}> <Text style={styles.header}>Device Information:</Text> {Object.entries(deviceDetails).map(([key, value]) => ( <Text key={key} style={styles.detailText}> {key}: {String(value)} </Text> ))} </View> ); }; const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', padding: 20, backgroundColor: '#f0f0f0', }, header: { fontSize: 24, fontWeight: 'bold', marginBottom: 20, color: '#333', }, detailText: { fontSize: 16, marginBottom: 5, color: '#555', }, }); export default App;
Debug
Known issues
breakingUpgrading to v15.0.0 requires your Android project to use 'compileSdk 34' or higher. Applications targeting lower API levels will fail to build.
fix
Update `compileSdkVersion` in your `android/build.gradle` file to 34 or higher.
affects: >=15.0.0
breakingVersion 14.0.0 removed the automatic addition of the AD_ID permission by discontinuing the auto-addition of 'play-services-iid'. This may affect features relying on this permission.
fix
Manually add the `com.google.android.gms:play-services-iid` dependency and declare `AD_ID` permission in `AndroidManifest.xml` if your application explicitly requires it.
affects: >=14.0.0
breakingVersion 7.x introduced a minimum iOS deployment target of 10. Applications targeting iOS 9 or lower will no longer be supported.
fix
Update your iOS Podfile to specify `platform :ios, '10.0'` or higher.
affects: >=7.0.0
gotchaThe module defaults to AndroidX. If your project does not use AndroidX, you will need to configure `jetifier` in reverse mode or upgrade your project.
fix
Ensure your project is migrated to AndroidX, or follow the `jetifier` documentation for reverse mode if sticking to older support libraries.
affects: *
gotchaWhen using Proguard/R8 in release builds, you must add specific rules to prevent issues with features like Install Referrer tracking or `hasGms()` detection, which might be stripped otherwise.
fix
Add `-keep class com.android.installreferrer.api.** {*;}` and `-keep class com.google.android.gms.common.** {*;}` to your Proguard configuration (`proguard-rules.pro`).
affects: *
gotchaNew React Native developers often encounter 'RNDeviceInfo is null' errors due to incorrect native module linking. While automatic linking is supported for modern RN versions, manual steps or project misconfigurations can cause this.
fix
Ensure your React Native version is >=0.63 for automatic linking. For older versions, carefully follow the manual linking instructions specific to your React Native version, or upgrade React Native.
affects: <=0.62
Errors
Common errors & fixes
RNDeviceInfo is null
The native module for react-native-device-info was not correctly linked or initialized by React Native.
fix
Ensure your React Native project is correctly set up for autolinking (React Native >= 0.63). If you are on an older version or using a specific setup, manually verify all linking steps for iOS, Android, and other platforms. Consider running `npx react-native doctor` for diagnostics.
Program type already present: com.google.android.gms.common.api.internal.zzb
Duplicate or conflicting Google Play Services dependencies in your Android project's `build.gradle` files.
fix
Review your `android/build.gradle` files (root and app level) for multiple versions or conflicting inclusions of Google Play Services libraries. Use `gradlew :app:dependencies` to identify duplicates and exclude them if necessary.
A problem occurred evaluating project ':react-native-device-info'. > Requires compileSdk 34+
Your project's `compileSdkVersion` in `android/build.gradle` is lower than 34 after upgrading react-native-device-info to v15.x.
fix
Update `compileSdkVersion` in your `android/build.gradle` file to at least 34. For example: `ext { compileSdkVersion = 34 }`.
java.lang.NullPointerException: Attempt to invoke virtual method '...' on a null object reference (related to hasKeyboard)
This specific NullPointerException occurred in earlier versions (pre-14.1.1) of the library on Android when calling the `hasKeyboard` function.
fix
Upgrade `react-native-device-info` to version 14.1.1 or higher to resolve the NullPointerException in the `hasKeyboard` function on Android.
Upgrade
Version history
15.0.2latest on npm
Audit
Dependencies
react-nativerequiredCore React Native functionality
Agent activity
13 hits · last 30 days
node
10
Meta
1
OpenAI (training)
1
Resources