# react-native-device-info
**Repository Path**: mirrors_mattermost/react-native-device-info
## Basic Information
- **Project Name**: react-native-device-info
- **Description**: Device Information for React Native iOS and Android
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2021-10-22
- **Last Updated**: 2026-03-01
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# react-native-device-info
[](http://badge.fury.io/js/react-native-device-info)
[](https://img.shields.io/npm/dt/react-native-device-info.svg)
[](https://img.shields.io/npm/dm/react-native-device-info.svg)
[](https://img.shields.io/npm/dw/react-native-device-info.svg)
Device Information for [React Native](https://github.com/facebook/react-native).
## TOC
* [Installation](#installation)
* [Linking](#linking)
* [Usage](#usage)
* [API](#api)
* [Troubleshooting](#troubleshooting)
* [Release Notes](#release-notes)
* [react-native-dom / react-native-web](#react-native-dom)
## Installation
Using npm:
```shell
npm install --save react-native-device-info
```
or using yarn:
```shell
yarn add react-native-device-info
```
> ⚠️ If you are on React Native > 0.47, you must use version 0.11.0 of this library or higher
## Linking
### Automatic
```shell
react-native link react-native-device-info
```
(or using [`rnpm`](https://github.com/rnpm/rnpm) for versions of React Native < 0.27)
```shell
rnpm link react-native-device-info
```
*For iOS users using Pods*
You still need to run `pod install` after running the above link command inside your `IOS` folder.
### Manual
iOS (via CocoaPods)
Add the following line to your build targets in your `Podfile`
`pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'`
Then run `pod install`
iOS (without CocoaPods)
In XCode, in the project navigator:
* Right click _Libraries_
* Add Files to _[your project's name]_
* Go to `node_modules/react-native-device-info/ios`
* Add the file `RNDeviceInfo.xcodeproj`
In XCode, in the project navigator, select your project.
* Add the `libRNDeviceInfo.a` from the _deviceinfo_ project to your project's _Build Phases ➜ Link Binary With Libraries_
* Click `.xcodeproj` file you added before in the project navigator and go the _Build Settings_ tab. Make sure _All_ is toggled on (instead of _Basic_).
* Look for _Header Search Paths_ and make sure it contains both `$(SRCROOT)/../react-native/React` and `$(SRCROOT)/../../React`
* Mark both as recursive (should be OK by default).
Run your project (Cmd+R)
(Thanks to @brysgo for writing the instructions)
Android
* **_optional_** in `android/build.gradle`:
```gradle
...
ext {
// dependency versions
googlePlayServicesVersion = "" // default: "+"
compileSdkVersion = "" // default: 23
buildToolsVersion = "" // default: "25.0.2"
targetSdkVersion = "" // default: 22
}
...
```
* in `android/app/build.gradle`:
```diff
dependencies {
...
implementation "com.facebook.react:react-native:+" // From node_modules
+ implementation project(':react-native-device-info')
}
```
* in `android/settings.gradle`:
```diff
...
include ':app'
+ include ':react-native-device-info'
+ project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android')
```
#### With React Native 0.29+
* in `MainApplication.java`:
```diff
+ import com.learnium.RNDeviceInfo.RNDeviceInfo;
public class MainApplication extends Application implements ReactApplication {
//......
@Override
protected List getPackages() {
return Arrays.asList(
+ new RNDeviceInfo(),
new MainReactPackage()
);
}
......
}
```
#### With older versions of React Native:
* in `MainActivity.java`:
```diff
+ import com.learnium.RNDeviceInfo.RNDeviceInfo;
public class MainActivity extends ReactActivity {
......
@Override
protected List getPackages() {
return Arrays.asList(
+ new RNDeviceInfo(),
new MainReactPackage()
);
}
}
```
NOTE: If you faced with this error: `Could not resolve all files for configuration ':react-native-device-info:debugCompileClasspath'.`, in `build.gradle` put `google()` in the first line (according to https://stackoverflow.com/a/50748249)
* in `android/build.gradle`:
```diff
allprojects {
repositories {
+ google()
...
}
}
```
(Thanks to @chirag04 for writing the instructions)
Windows
* Open the solution in Visual Studio for your Windows apps
* right click your in the Explorer and click Add > Existing Project...
* Navigate to `.//node_modules/react-native-device-info/windows/RNDeviceInfo` and add `RNDeviceInfo.csproj`
* this time right click on your React Native Windows app under your solutions directory and click Add > Reference...
* check the `RNDeviceInfo` you just added and press ok
* open up `MainReactNativeHost.cs` for your app and edit the file like so:
```diff
+ using RNDeviceInfo;
......
protected override List Packages => new List
{
new MainReactPackage(),
+ new RNDeviceInfoPackage(),
};
```
(Thanks to @josephan for writing the instructions)
## Usage
```js
import DeviceInfo from 'react-native-device-info';
```
## API
| Method | Return Type | iOS | Android | Windows | Since |
| ----------------------------------------------------------------- | ------------------- | :--: | :-----: | :-----: | ------ |
| [getAPILevel()](#getapilevel) | `number` | ❌ | ✅ | ❌ | 0.12.0 |
| [getApplicationName()](#getapplicationname) | `string` | ✅ | ✅ | ✅ | 0.14.0 |
| [getBatteryLevel()](#getbatterylevel) | `Promise` | ✅ | ✅ | ✅ | 0.18.0 |
| [getBrand()](#getbrand) | `string` | ✅ | ✅ | ✅ | 0.9.3 |
| [getBuildNumber()](#getbuildnumber) | `string` | ✅ | ✅ | ✅ | ? |
| [getBundleId()](#getbundleid) | `string` | ✅ | ✅ | ✅ | ? |
| [getCameraPresence()](#getcamerapresence) | `Promise` | ❌ | ✅ | ✅ | ? |
| [getCarrier()](#getcarrier) | `string` | ✅ | ✅ | ❌ | 0.13.0 |
| [getDeviceCountry()](#getdevicecountry) | `string` | ✅ | ✅ | ✅ | 0.9.0 |
| [getDeviceId()](#getdeviceid) | `string` | ✅ | ✅ | ✅ | 0.5.0 |
| [getDeviceLocale()](#getdevicelocale) | `string` | ✅ | ✅ | ✅ | 0.7.0 |
| [getPreferredLocales()](#getpreferredlocale) | `Array` | ✅ | ✅ | ❌ | ? |
| [getDeviceName()](#getdevicename) | `string` | ✅ | ✅ | ✅ | ? |
| [getFirstInstallTime()](#getfirstinstalltime) | `number` | ❌ | ✅ | ✅ | 0.12.0 |
| [getFontScale()](#getfontscale) | `number` | ✅ | ✅ | ❌ | 0.15.0 |
| [getFreeDiskStorage()](#getfreediskstorage) | `number` | ✅ | ✅ | ❌ | 0.15.0 |
| [getIPAddress()](#getipaddress) | `Promise` | ✅ | ✅ | ✅ | 0.12.0 |
| [getInstallReferrer()](#getinstallreferrer) | `string` | ❌ | ✅ | ❌ | 0.19.0 |
| [getInstanceID()](#getinstanceid) | `string` | ❌ | ✅ | ❌ | ? |
| [getLastUpdateTime()](#getlastupdatetime) | `number` | ❌ | ✅ | ❌ | 0.12.0 |
| [getMACAddress()](#getmacaddress) | `Promise` | ✅ | ✅ | ❌ | 0.12.0 |
| [getManufacturer()](#getmanufacturer) | `string` | ✅ | ✅ | ✅ | ? |
| [getMaxMemory()](#getmaxmemory) | `number` | ❌ | ✅ | ✅ | 0.14.0 |
| [getModel()](#getmodel) | `string` | ✅ | ✅ | ✅ | ? |
| [getPhoneNumber()](#getphonenumber) | `string` | ❌ | ✅ | ❌ | 0.12.0 |
| [getPowerState()](#getpowerstate) | `Promise