{"id":11768,"library":"react-native-device-info","title":"React Native Device Information","description":"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.","status":"active","version":"15.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/react-native-device-info/react-native-device-info","tags":["javascript","react-component","react-native","ios","android","windows","device","events","cocoapod","typescript"],"install":[{"cmd":"npm install react-native-device-info","lang":"bash","label":"npm"},{"cmd":"yarn add react-native-device-info","lang":"bash","label":"yarn"},{"cmd":"pnpm add react-native-device-info","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core React Native functionality","package":"react-native","optional":false}],"imports":[{"note":"This is the default export for the full API surface, commonly used for accessing multiple methods or for quick access.","wrong":"import { DeviceInfo } from 'react-native-device-info';","symbol":"DeviceInfo","correct":"import DeviceInfo from 'react-native-device-info';"},{"note":"Use named imports for individual functions to leverage tree-shaking and improve bundle size, especially if only a few functions are needed.","wrong":"import DeviceInfo from 'react-native-device-info'; const getUniqueId = DeviceInfo.getUniqueId;","symbol":"getUniqueId","correct":"import { getUniqueId } from 'react-native-device-info';"},{"note":"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.","wrong":"const { getManufacturer } = require('react-native-device-info');","symbol":"getManufacturer","correct":"import { getManufacturer } from 'react-native-device-info';"},{"note":"TypeScript users should import types separately for type checking, enhancing code reliability.","symbol":"DeviceType","correct":"import type { DeviceType } from 'react-native-device-info';"}],"quickstart":{"code":"import DeviceInfo, {\n  getUniqueId,\n  getManufacturer,\n  getSystemName,\n  getSystemVersion,\n  isTablet,\n  getApplicationName,\n  getVersion,\n  getBuildNumber\n} from 'react-native-device-info';\nimport { View, Text, StyleSheet } from 'react-native';\nimport React from 'react';\n\nconst App = () => {\n  const [deviceDetails, setDeviceDetails] = React.useState({});\n\n  React.useEffect(() => {\n    async function fetchDeviceInfo() {\n      const uniqueId = await getUniqueId();\n      const manufacturer = await getManufacturer();\n      const systemName = getSystemName();\n      const systemVersion = getSystemVersion();\n      const isTabletDevice = isTablet();\n      const appName = getApplicationName();\n      const appVersion = getVersion();\n      const buildNumber = getBuildNumber();\n\n      setDeviceDetails({\n        uniqueId,\n        manufacturer,\n        systemName,\n        systemVersion,\n        isTablet: isTabletDevice,\n        appName,\n        appVersion,\n        buildNumber,\n        deviceBrand: DeviceInfo.getBrand(),\n        model: DeviceInfo.getModel(),\n        hasNotch: DeviceInfo.hasNotch(),\n      });\n    }\n    fetchDeviceInfo();\n  }, []);\n\n  return (\n    <View style={styles.container}>\n      <Text style={styles.header}>Device Information:</Text>\n      {Object.entries(deviceDetails).map(([key, value]) => (\n        <Text key={key} style={styles.detailText}>\n          {key}: {String(value)}\n        </Text>\n      ))}\n    </View>\n  );\n};\n\nconst styles = StyleSheet.create({\n  container: {\n    flex: 1,\n    justifyContent: 'center',\n    alignItems: 'center',\n    padding: 20,\n    backgroundColor: '#f0f0f0',\n  },\n  header: {\n    fontSize: 24,\n    fontWeight: 'bold',\n    marginBottom: 20,\n    color: '#333',\n  },\n  detailText: {\n    fontSize: 16,\n    marginBottom: 5,\n    color: '#555',\n  },\n});\n\nexport default App;\n","lang":"typescript","description":"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."},"warnings":[{"fix":"Update `compileSdkVersion` in your `android/build.gradle` file to 34 or higher.","message":"Upgrading to v15.0.0 requires your Android project to use 'compileSdk 34' or higher. Applications targeting lower API levels will fail to build.","severity":"breaking","affected_versions":">=15.0.0"},{"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.","message":"Version 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.","severity":"breaking","affected_versions":">=14.0.0"},{"fix":"Update your iOS Podfile to specify `platform :ios, '10.0'` or higher.","message":"Version 7.x introduced a minimum iOS deployment target of 10. Applications targeting iOS 9 or lower will no longer be supported.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Ensure your project is migrated to AndroidX, or follow the `jetifier` documentation for reverse mode if sticking to older support libraries.","message":"The module defaults to AndroidX. If your project does not use AndroidX, you will need to configure `jetifier` in reverse mode or upgrade your project.","severity":"gotcha","affected_versions":"*"},{"fix":"Add `-keep class com.android.installreferrer.api.** {*;}` and `-keep class com.google.android.gms.common.** {*;}` to your Proguard configuration (`proguard-rules.pro`).","message":"When 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.","severity":"gotcha","affected_versions":"*"},{"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.","message":"New 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.","severity":"gotcha","affected_versions":"<=0.62"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"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.","cause":"The native module for react-native-device-info was not correctly linked or initialized by React Native.","error":"RNDeviceInfo is null"},{"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.","cause":"Duplicate or conflicting Google Play Services dependencies in your Android project's `build.gradle` files.","error":"Program type already present: com.google.android.gms.common.api.internal.zzb"},{"fix":"Update `compileSdkVersion` in your `android/build.gradle` file to at least 34. For example: `ext { compileSdkVersion = 34 }`.","cause":"Your project's `compileSdkVersion` in `android/build.gradle` is lower than 34 after upgrading react-native-device-info to v15.x.","error":"A problem occurred evaluating project ':react-native-device-info'. > Requires compileSdk 34+"},{"fix":"Upgrade `react-native-device-info` to version 14.1.1 or higher to resolve the NullPointerException in the `hasKeyboard` function on Android.","cause":"This specific NullPointerException occurred in earlier versions (pre-14.1.1) of the library on Android when calling the `hasKeyboard` function.","error":"java.lang.NullPointerException: Attempt to invoke virtual method '...' on a null object reference (related to hasKeyboard)"}],"ecosystem":"npm"}