Device Information for React Native iOS and Android
Installations
npm install react-native-device-info
Developer
react-native-device-info
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
Yes
Node Version
16.20.2
NPM Version
8.12.0
Statistics
6,485 Stars
1,344 Commits
1,467 Forks
72 Watching
4 Branches
312 Contributors
Updated on 25 Nov 2024
Bundle Size
34.61 kB
Minified
6.75 kB
Minified + Gzipped
Languages
TypeScript (31.94%)
Java (22.51%)
Objective-C (19.42%)
C++ (12.35%)
JavaScript (9.61%)
Shell (2.64%)
Ruby (1.02%)
C (0.29%)
Starlark (0.21%)
Total Downloads
Cumulative downloads
Total Downloads
93,333,560
Last day
-4.5%
124,817
Compared to previous day
Last week
2.8%
611,247
Compared to previous week
Last month
8.7%
2,575,475
Compared to previous month
Last year
24.5%
25,667,565
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Peer Dependencies
1
Dev Dependencies
25
react-native-device-info
Device Information for React Native.
TOC
- Installation
- Linking
- Usage
- API
- Hooks & Events
- Troubleshooting
- Release Notes
- react-native-dom / react-native-web
v6 to v7 upgrade
Your iOS Podfile will need to move to an iOS 10 minimum. v7 of this module no longer supports iOS9.
Installation
Using npm:
1npm install --save react-native-device-info
or using yarn:
1yarn add react-native-device-info
Proguard
If you want to use Install Referrer tracking, you will need to add this config to your Proguard config
-keep class com.android.installreferrer.api.** {
*;
}
If you are experiencing issues with hasGms() on your release apks, please add the following rule to your Proguard config
-keep class com.google.android.gms.common.** {*;}
AndroidX Support
This module defaults to AndroidX you should configure your library versions similar to this in your android/build.gradle
file's "ext" block
Android
1... 2 ext { 3 // dependency versions 4 5 We have 3 options for deviceId: 6 //Option 1 (latest): 7 firebaseIidVersion = "19.0.1" // default: "19.0.1" 8 //Option 2 (legacy GooglePlay dependency but using AndroidX): 9 googlePlayServicesIidVersion = "17.0.0" // default: "17.0.0" - AndroidX 10 //Option 3 (legacy GooglePlay dependency before AndroidX): 11 googlePlayServicesIidVersion = "16.0.1" 12 13 14 //include as needed: 15 compileSdkVersion = "28" // default: 28 (28 is required for AndroidX) 16 targetSdkVersion = "28" // default: 28 (28 is required for AndroidX) 17 supportLibVersion = '1.0.2' // Use '28.0.0' or don't specify for old libraries, '1.0.2' or similar for AndroidX 18 mediaCompatVersion = '1.0.1' // Do not specify if using old libraries, specify '1.0.1' or similar for androidx.media:media dependency 19 supportV4Version = '1.0.0' // Do not specify if using old libraries, specify '1.0.0' or similar for androidx.legacy:legacy-support-v4 dependency 20 } 21...
If you need non-AndroidX you will need to use the jetifier package in reverse mode, documentation available with that package.
Linking
Linking in native modules is a frequent source of trouble for new react-native developers, resulting in errors like "RNDeviceInfo is null" etc. For this reason automatic linking was implemented, and it should be used in your project.
Automatic linking is supported for all platforms (even windows on React native >= 0.63!)
Previous versions need to do manual linking. No support is offered for these previous react-native versions but you may refer to older versions of this README if you like. Upgrade to modern versions of react-native. Use upgrade-helper
tool on the internet if needed.
Usage
1import DeviceInfo from 'react-native-device-info'; 2 3// or ES6+ destructured imports 4 5import { getUniqueId, getManufacturer } from 'react-native-device-info';
API
Note that many APIs are platform-specific. If there is no implementation for a platform, then the "default" return values you will receive are "unknown"
for string, -1
for number, and false
for boolean. Arrays and Objects will be empty ([]
and {}
respectively).
Most APIs return a Promise but also have a corresponding API with Sync
on the end that operates synchronously. For example, you may prefer to call isCameraPresentSync()
during your app bootstrap to avoid async calls during the first parts of app startup.
Note about getUserAgentSync
While the asynchronous method getUserAgent
is available on both platforms, getUserAgentSync
is only supported on Android.
The example app in this repository shows an example usage of every single API, consult the example app if you have questions, and if you think you see a problem make sure you can reproduce it using the example app before reporting it, thank you.
Method | Return Type | iOS | Android | Windows | Web | visionOS |
---|---|---|---|---|---|---|
getAndroidId() | Promise<string> | ❌ | ✅ | ❌ | ❌ | ❌ |
getApiLevel() | Promise<number> | ❌ | ✅ | ❌ | ❌ | ❌ |
getApplicationName() | string | ✅ | ✅ | ✅ | ❌ | ✅ |
getAvailableLocationProviders() | Promise<Object> | ✅ | ✅ | ❌ | ❌ | ✅ |
getBaseOs() | Promise<string> | ❌ | ✅ | ✅ | ✅ | ❌ |
getBuildId() | Promise<string> | ✅ | ✅ | ✅ | ❌ | ✅ |
getBatteryLevel() | Promise<number> | ✅ | ✅ | ✅ | ✅ | ✅ |
getBootloader() | Promise<string> | ❌ | ✅ | ❌ | ❌ | ❌ |
getBrand() | string | ✅ | ✅ | ✅ | ❌ | ✅ |
getBuildNumber() | string | ✅ | ✅ | ✅ | ❌ | ✅ |
getBundleId() | string | ✅ | ✅ | ✅ | ❌ | ✅ |
isCameraPresent() | Promise<boolean> | ❌ | ✅ | ✅ | ✅ | ❌ |
getCarrier() | Promise<string> | ✅ | ✅ | ❌ | ❌ | ❌ |
getCodename() | Promise<string> | ❌ | ✅ | ❌ | ❌ | ❌ |
getDevice() | Promise<string> | ❌ | ✅ | ❌ | ❌ | ❌ |
getDeviceId() | string | ✅ | ✅ | ✅ | ❌ | ✅ |
getDeviceType() | string | ✅ | ✅ | ❌ | ❌ | ✅ |
getDisplay() | Promise<string> | ❌ | ✅ | ❌ | ❌ | ❌ |
getDeviceName() | Promise<string> | ✅ | ✅ | ✅ | ❌ | ✅ |
getDeviceToken() | Promise<string> | ✅ | ❌ | ❌ | ❌ | ✅ |
getFirstInstallTime() | Promise<number> | ✅ | ✅ | ✅ | ❌ | ✅ |
getFingerprint() | Promise<string> | ❌ | ✅ | ❌ | ❌ | ❌ |
getFontScale() | Promise<number> | ✅ | ✅ | ✅ | ❌ | ❌ |
getFreeDiskStorage() | Promise<number> | ✅ | ✅ | ✅ | ✅ | ✅ |
getFreeDiskStorageOld() | Promise<number> | ✅ | ✅ | ✅ | ✅ | ✅ |
getHardware() | Promise<string> | ❌ | ✅ | ❌ | ❌ | ❌ |
getHost() | Promise<string> | ❌ | ✅ | ✅ | ❌ | ❌ |
getHostNames() | Promise<string[]> | ❌ | ❌ | ✅ | ❌ | ❌ |
getIpAddress() | Promise<string> | ✅ | ✅ | ✅ | ❌ | ✅ |
getIncremental() | Promise<string> | ❌ | ✅ | ❌ | ❌ | ❌ |
getInstallerPackageName() | Promise<string> | ✅ | ✅ | ✅ | ❌ | ✅ |
getInstallReferrer() | Promise<string> | ❌ | ✅ | ✅ | ✅ | ❌ |
getInstanceId() | Promise<string> | ❌ | ✅ | ❌ | ❌ | ❌ |
getLastUpdateTime() | Promise<number> | ❌ | ✅ | ❌ | ❌ | ❌ |
getMacAddress() | Promise<string> | ✅ | ✅ | ❌ | ❌ | ✅ |
getManufacturer() | Promise<string> | ✅ | ✅ | ✅ | ❌ | ✅ |
getMaxMemory() | Promise<number> | ❌ | ✅ | ✅ | ✅ | ❌ |
getModel() | string | ✅ | ✅ | ✅ | ❌ | ✅ |
getPowerState() | Promise<object> | ✅ | ✅ | ✅ | ✅ | ✅ |
getProduct() | Promise<string> | ❌ | ✅ | ❌ | ❌ | ❌ |
getPreviewSdkInt() | Promise<number> | ❌ | ✅ | ❌ | ❌ | ❌ |
getReadableVersion() | string | ✅ | ✅ | ✅ | ❌ | ✅ |
getSerialNumber() | Promise<string> | ❌ | ✅ | ✅ | ❌ | ❌ |
getSecurityPatch() | Promise<string> | ❌ | ✅ | ❌ | ❌ | ❌ |
getStartupTime() | Promise<number> | ✅ | ✅ | ❌ | ❌ | ✅ |
getSystemAvailableFeatures() | Promise<string[]> | ❌ | ✅ | ❌ | ❌ | ❌ |
getSystemName() | string | ✅ | ✅ | ✅ | ❌ | ✅ |
getSystemVersion() | string | ✅ | ✅ | ✅ | ❌ | ✅ |
getTags() | Promise<string> | ❌ | ✅ | ❌ | ❌ | ❌ |
getType() | Promise<string> | ❌ | ✅ | ❌ | ❌ | ❌ |
getTotalDiskCapacity() | Promise<number> | ✅ | ✅ | ✅ | ✅ | ✅ |
getTotalDiskCapacityOld() | Promise<number> | ✅ | ✅ | ✅ | ✅ | ✅ |
getTotalMemory() | Promise<number> | ✅ | ✅ | ❌ | ✅ | ✅ |
getUniqueId() | Promise<string> | ✅ | ✅ | ✅ | ❌ | ✅ |
getUsedMemory() | Promise<number> | ✅ | ✅ | ✅ | ✅ | ✅ |
getUserAgent() | Promise<string> | ✅ | ✅ | ❌ | ✅ | ✅ |
getUserAgentSync() | string | ❌ | ✅ | ❌ | ✅ | ❌ |
getVersion() | string | ✅ | ✅ | ✅ | ❌ | ✅ |
getBrightness() | Promise<number> | ✅ | ❌ | ❌ | ❌ | ❌ |
hasGms() | Promise<boolean> | ❌ | ✅ | ❌ | ❌ | ❌ |
hasHms() | Promise<boolean> | ❌ | ✅ | ❌ | ❌ | ❌ |
hasNotch() | boolean | ✅ | ✅ | ✅ | ❌ | ✅ |
hasDynamicIsland() | boolean | ✅ | ✅ | ✅ | ❌ | ✅ |
hasSystemFeature() | Promise<boolean> | ❌ | ✅ | ❌ | ❌ | ❌ |
isAirplaneMode() | Promise<boolean> | ❌ | ✅ | ❌ | ✅ | ❌ |
isBatteryCharging() | Promise<boolean> | ✅ | ✅ | ✅ | ✅ | ✅ |
isEmulator() | Promise<boolean> | ✅ | ✅ | ✅ | ❌ | ✅ |
isKeyboardConnected() | Promise<bool> | ❌ | ❌ | ✅ | ❌ | ❌ |
isLandscape() | Promise<boolean> | ✅ | ✅ | ✅ | ❌ | ✅ |
isLocationEnabled() | Promise<boolean> | ✅ | ✅ | ❌ | ✅ | ✅ |
isMouseConnected() | Promise<bool> | ❌ | ❌ | ✅ | ❌ | ❌ |
isHeadphonesConnected() | Promise<boolean> | ✅ | ✅ | ❌ | ❌ | ✅ |
isWiredHeadphonesConnected() | Promise<boolean> | ✅ | ✅ | ❌ | ❌ | ✅ |
isBluetoothHeadphonesConnected() | Promise<boolean> | ✅ | ✅ | ❌ | ❌ | ✅ |
isPinOrFingerprintSet() | Promise<boolean> | ✅ | ✅ | ✅ | ❌ | ✅ |
isTablet() | boolean | ✅ | ✅ | ✅ | ❌ | ✅ |
isLowRamDevice() | boolean | ❌ | ✅ | ❌ | ❌ | ❌ |
isDisplayZoomed() | boolean | ✅ | ❌ | ❌ | ❌ | ❌ |
isTabletMode() | Promise<bool> | ❌ | ❌ | ✅ | ❌ | ❌ |
supported32BitAbis() | Promise<string[]> | ❌ | ✅ | ❌ | ❌ | ❌ |
supported64BitAbis() | Promise<string[]> | ❌ | ✅ | ❌ | ❌ | ❌ |
supportedAbis() | Promise<string[]> | ✅ | ✅ | ✅ | ❌ | ✅ |
syncUniqueId() | Promise<string> | ✅ | ❌ | ❌ | ❌ | ✅ |
getSupportedMediaTypeList() | Promise<string[]> | ❌ | ✅ | ❌ | ❌ | ❌ |
getApiLevel()
Gets the API level.
Examples
1DeviceInfo.getApiLevel().then((apiLevel) => { 2 // iOS: ? 3 // Android: 25 4 // Windows: ? 5});
Notes
See API Levels
getAndroidId()
Gets the ANDROID_ID. See API documentation for appropriate use.
Examples
1DeviceInfo.getAndroidId().then((androidId) => { 2 // androidId here 3});
getApplicationName()
Gets the application name.
Examples
1let appName = DeviceInfo.getApplicationName();
2// AwesomeApp
getBaseOs()
The base OS build the product is based on.
Examples
1DeviceInfo.getBaseOs().then((baseOs) => { 2 // "Windows", "Android" etc 3});
getBatteryLevel()
Gets the battery level of the device as a float comprised between 0 and 1.
Examples
1DeviceInfo.getBatteryLevel().then((batteryLevel) => { 2 // 0.759999 3});
Notes
To be able to get actual battery level enable battery monitoring mode for application. Add this code:
1[UIDevice currentDevice].batteryMonitoringEnabled = true;
to AppDelegate.m application:didFinishLaunchingWithOptions:
Returns -1 on the iOS Simulator
getBootloader()
The system bootloader version number.
Examples
1DeviceInfo.getBootloader().then((bootloader) => { 2 // "mw8998-002.0069.00" 3});
getBrand()
Gets the device brand.
Examples
1let brand = DeviceInfo.getBrand(); 2// iOS: "Apple" 3// Android: "xiaomi" 4// Windows: ?
getBuildNumber()
Gets the application build number.
Examples
1let buildNumber = DeviceInfo.getBuildNumber(); 2// iOS: "89" 3// Android: "4" 4// Windows: ?
getBundleId()
Gets the application bundle identifier.
Examples
1let bundleId = DeviceInfo.getBundleId();
2// "com.example.AwesomeApp"
isCameraPresent()
Tells if the device has any camera now.
Examples
1DeviceInfo.isCameraPresent() 2 .then((isCameraPresent) => { 3 // true or false 4 }) 5 .catch((cameraAccessException) => { 6 // is thrown if a camera device could not be queried or opened by the CameraManager on Android 7 });
Notes
- Hot add/remove of camera is supported.
- Returns the status of the physical presence of the camera. If camera present but your app don't have permissions to use it, isCameraPresent will still return the true
getCarrier()
Gets the carrier name (network operator).
Examples
1DeviceInfo.getCarrier().then((carrier) => { 2 // "SOFTBANK" 3});
getCodename()
The current development codename, or the string "REL" if this is a release build.
Examples
1DeviceInfo.getCodename().then((codename) => { 2 // "REL" 3});
getDevice()
The name of the industrial design.
Examples
1DeviceInfo.getDevice().then((device) => { 2 // "walleye" 3});
getDeviceId()
Gets the device ID.
Examples
1let deviceId = DeviceInfo.getDeviceId(); 2// iOS: "iPhone7,2" 3// Android: "goldfish" 4// Windows: "Y3R94UC#AC4"
getDisplay()
A build ID string meant for displaying to the user.
Examples
1DeviceInfo.getDisplay().then((display) => { 2 // "OPM2.171026.006.G1" 3});
getDeviceName()
Gets the device name.
Examples
1DeviceInfo.getDeviceName().then((deviceName) => { 2 // iOS: "Becca's iPhone 6" 3 // Android: ? 4 // Windows: ? 5});
This used to require the android.permission.BLUETOOTH but the new implementation in v3 does not need it. You may remove that from your AndroidManifest.xml if you had it for this API. iOS 16 and greater require entitlements to access user-defined device name, otherwise a generic value is returned (ie. 'iPad', 'iPhone')
getDeviceToken()
Gets the device token (see DeviceCheck). Only available for iOS 11.0+ on real devices. This will reject the promise when getDeviceToken is not supported, be careful with exception handling.
Examples
1DeviceInfo.getDeviceToken().then((deviceToken) => { 2 // iOS: "a2Jqsd0kanz..." 3});
getFirstInstallTime()
Gets the time at which the app was first installed, in milliseconds.
Examples
1DeviceInfo.getFirstInstallTime().then((firstInstallTime) => { 2 // Android: 1517681764528 3});
getFingerprint()
A string that uniquely identifies this build.
Examples
1DeviceInfo.getFingerprint().then((fingerprint) => { 2 // "google/walleye/walleye:8.1.0/OPM2.171026.006.G1/4820017:user/release-keys" 3});
getFontScale()
Gets the device font scale. The font scale is the ratio of the current system font to the "normal" font size, so if normal text is 10pt and the system font is currently 15pt, the font scale would be 1.5 This can be used to determine if accessability settings has been changed for the device; you may want to re-layout certain views if the font scale is significantly larger ( > 2.0 )
Examples
1DeviceInfo.getFontScale().then((fontScale) => { 2 // 1.2 3});
getFreeDiskStorage()
Method that gets available storage size, in bytes, taking into account both root and data file systems calculation.
On iOS, this method accepts the following optional arguments:
'total'
: UsesvolumeAvailableCapacityKey
'important'
: UsesvolumeAvailableCapacityForImportantUsageKey
'opportunistic'
: UsesvolumeAvailableCapacityForOpportunisticUsageKey
For more details, refer to Apple Documentation on Checking Volume Storage Capacity.
Examples
1DeviceInfo.getFreeDiskStorage().then((freeDiskStorage) => { 2 // Android: 17179869184 3 // iOS: 17179869184 4}); 5 6DeviceInfo.getFreeDiskStorage('important').then((freeDiskStorage) => { 7 // iOS: 18198219342 (important storage) 8});
Notes
The API used by this method for Android was changed in v6.0.0. The older version has been maintained below as getFreeDiskStorageOld()
. On iOS, getFreeDiskStorage()
and getFreeDiskStorageOld()
return the same value.
getFreeDiskStorageOld()
Old implementation of method that gets available storage size, in bytes.
Examples
1DeviceInfo.getFreeDiskStorageOld().then((freeDiskStorage) => { 2 // Android: 17179869184 3 // iOS: 17179869184 4});
Notes
From developer.android.com:
This method was deprecated in API level 29.
Return the primary shared/external storage directory.
Note: don't be confused by the word "external" here. This directory can better be thought as media/shared storage. It is a filesystem that can hold a relatively large amount of data and that is shared across all applications (does not enforce permissions). Traditionally this is an SD card, but it may also be implemented as built-in storage in a device that is distinct from the protected internal storage and can be mounted as a filesystem on a computer.
getHardware()
The name of the hardware (from the kernel command line or /proc).
Examples
1DeviceInfo.getHardware().then(hardware => { 2 // "walleye" 3});
getHost()
Hostname
Examples
1DeviceInfo.getHost().then((host) => { 2 // "wprd10.hot.corp.google.com" 3});
getIpAddress()
Deprecated Gets the device current IP address. (of wifi only) Switch to react-native-netinfo/netinfo or react-native-network-info
Examples
1DeviceInfo.getIpAddress().then((ip) => { 2 // "92.168.32.44" 3});
Android Permissions
Notes
Support for iOS was added in 0.22.0
getIncremental()
The internal value used by the underlying source control to represent this build.
Examples
1DeviceInfo.getIncremental().then((incremental) => { 2 // "4820017" 3});
getInstallerPackageName()
The internal value used by the underlying source control to represent this build.
Examples
1DeviceInfo.getInstallerPackageName().then((installerPackageName) => { 2 // Play Store: "com.android.vending" 3 // Amazon: "com.amazon.venezia" 4 // Samsung App Store: "com.sec.android.app.samsungapps" 5 // iOS: "AppStore", "TestFlight", "Other" 6});
getInstallReferrer()
Gets the referrer string upon application installation.
Examples
1DeviceInfo.getInstallReferrer().then((installReferrer) => { 2 // If the app was installed from https://play.google.com/store/apps/details?id=com.myapp&referrer=my_install_referrer 3 // the result will be "my_install_referrer" 4});
getInstanceId()
Gets the application instance ID.
This attempts to get an instance ID from these sources, in this order:
- a value under key
instanceId
in SharedPreferences filereact-native-device-info
- Firebase IID (if
firebaseBomVersion
orfirebaseIidVersion
is defined in gradle ext - deprecated) - GMS IID (if
googlePlayServicesIidVersion
orgooglePlayServicesVersion
is defined in gradle ext - deprecated) - a random UUID generated from java.util.UUID.randomUUID() and stored in SharedPreferences
If you are using the deprecated sources, the instance ID generated is stored in shared preferences so it will be stable during this major version of react-native-device-info.
In a future version of react-native-device-info, the Firebase IID and GMS IID implementations will be removed, and all future values will be the value (if any) stored in SharedPreferences, or a new random UUID that will then be stored and used for that app installation in the future.
Examples
1DeviceInfo.getInstanceId().then((instanceId) => { 2 // Android: da4e0245-5d6c-402a-a07c-0c5349f229e2 3});
Notes
getLastUpdateTime()
Gets the time at which the app was last updated, in milliseconds.
Examples
1DeviceInfo.getLastUpdateTime().then((lastUpdateTime) => { 2 // Android: 1517681764992 3});
getMacAddress()
Gets the network adapter MAC address.
Examples
1DeviceInfo.getMacAddress().then((mac) => { 2 // "E5:12:D8:E5:69:97" 3});
Android Permissions
Notes
iOS: This method always return "02:00:00:00:00:00" as retrieving the MAC address is disabled since iOS 7
getManufacturer()
Gets the device manufacturer.
Examples
1DeviceInfo.getManufacturer().then((manufacturer) => { 2 // iOS: "Apple" 3 // Android: "Google" 4 // Windows: ? 5});
getMaxMemory()
Returns the maximum amount of memory that the VM will attempt to use, in bytes.
Examples
1DeviceInfo.getMaxMemory().then((maxMemory) => { 2 // 402653183 3});
getModel()
Gets the device model.
iOS warning: The list with device names is maintained by the community and could lag new devices. It is recommended to use getDeviceId()
since it's more reliable and always up-to-date with new iOS devices. We do accept pull requests that add new iOS devices to the list with device names.
Examples
1let model = DeviceInfo.getModel();
2// iOS: ?
3// Android: ?
4// Windows: ?
getPhoneNumber()
The getPhoneNumber() has been removed. This method uses deprecated Android APIs. You can use react-native-sim-cards-manager to get the phone number.
getPowerState()
Gets the power state of the device including the battery level, whether it is plugged in, and if the system is currently operating in low power mode. Displays a warning on iOS if battery monitoring not enabled, or if attempted on an emulator (where monitoring is not possible)
Examples
1DeviceInfo.getPowerState().then((state) => { 2 // { 3 // batteryLevel: 0.759999, 4 // batteryState: 'unplugged', 5 // lowPowerMode: false, 6 // } 7});
getProduct()
The name of the overall product.
Examples
1DeviceInfo.getProduct().then((product) => { 2 // "walleye" 3});
getPreviewSdkInt()
The developer preview revision of a prerelease SDK.
Examples
1DeviceInfo.getPreviewSdkInt().then((previewSdkInt) => { 2 // 0 3});
getReadableVersion()
Gets the application human readable version (same as getVersion() + '.' + getBuildNumber())
Examples
1let readableVersion = DeviceInfo.getReadableVersion();
2// iOS: 1.0.1.32
3// Android: 1.0.1.234
4// Windows: ?
getSerialNumber()
Gets the device serial number. Will be 'unknown' in almost all cases unless you have a privileged app and you know what you're doing.
Examples
1DeviceInfo.getSerialNumber().then((serialNumber) => { 2 // iOS: unknown 3 // Android: ? (maybe a serial number, if your app is privileged) 4 // Windows: ? (a serial number, if your app has the "capability smbios") 5});
Notes
capability smbios
If you want to use this method in windows, you have to add smbios capability in your aplication. Please following this documentation for add the capability in your manifest file.
getSecurityPatch()
The user-visible security patch level.
Examples
1DeviceInfo.getSecurityPatch().then((securityPatch) => { 2 // "2018-07-05" 3});
getSystemName()
Gets the device OS name.
Examples
1let systemName = DeviceInfo.getSystemName(); 2// iOS: "iOS" on newer iOS devices "iPhone OS" on older devices (including older iPad models), "iPadOS" for iPads using iPadOS 15.0 or higher. 3// Android: "Android" 4// Windows: ?
getStartupTime()
Gets the time at which the current app process was started, in milliseconds.
Examples
1DeviceInfo.getStartupTime().then((startupTime) => { 2 // Android: 1517681764528 3 // iOS: 1517681764528 4});
getSystemVersion()
Gets the device OS version.
Examples
1let systemVersion = DeviceInfo.getSystemVersion(); 2// iOS: "11.0" 3// Android: "7.1.1" 4// Windows: ?
getBuildId()
Gets build number of the operating system.
Examples
1DeviceInfo.getBuildId().then((buildId) => { 2 // iOS: "12A269" 3 // tvOS: not available 4 // Android: "13D15" 5 // Windows: not available 6});
getTags()
Comma-separated tags describing the build.
Examples
1DeviceInfo.getTags().then((tags) => { 2 // "release-keys, unsigned, debug", 3});
getType()
The type of build.
Examples
1DeviceInfo.getType().then((type) => { 2 // "user", "eng" 3});
getTotalDiskCapacity()
Method that gets full disk storage size, in bytes, taking into account both root and data file systems calculation.
Examples
1DeviceInfo.getTotalDiskCapacity().then((capacity) => { 2 // Android: 17179869184 3 // iOS: 17179869184 4});
Notes
The API used by this method for Android was changed in v6.0.0. The older version has been maintained below as getTotalDiskCapacityOld()
. On iOS, getTotalDiskCapacity()
and getTotalDiskCapacityOld()
return the same value.
getTotalDiskCapacityOld()
Old implementation of method that gets full disk storage size, in bytes.
Examples
1DeviceInfo.getTotalDiskCapacityOld().then((capacity) => { 2 // Android: 17179869184 3 // iOS: 17179869184 4});
getTotalMemory()
Gets the device total memory, in bytes.
Examples
1DeviceInfo.getTotalMemory().then((totalMemory) => { 2 // 1995018240 3});
getUniqueId()
This identifier is considered sensitive information in some app stores (e.g. Huawei or Google Play) and may lead to your app being removed or rejected, if used without user consent or for unapproved purposes. Refer to store policies for more information (see notes below).
Gets the device unique ID.
On Android it is currently identical to getAndroidId()
in this module.
On iOS it uses the DeviceUID
uid identifier.
On Windows it uses Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation.id
.
Examples
1DeviceInfo.getUniqueId().then((uniqueId) => { 2// iOS: "FCDBD8EF-62FC-4ECB-B2F5-92C9E79AC7F9" 3// Android: "dd96dec43fb81c97" 4// Windows: "{2cf7cb3c-da7a-d508-0d7f-696bb51185b4}" 5});
Notes
- iOS: This is
IDFV
or a random string if IDFV is unavaliable. Once UID is generated it is stored in iOS Keychain and NSUserDefaults. So it would stay the same even if you delete the app or reset IDFV. You can carefully consider it a persistent unique ID. It can be changed only in case someone manually override values in Keychain/NSUserDefaults or if Apple would change Keychain and NSUserDefaults implementations. Beware: The IDFV is calculated using your bundle identifier and thus will be different in app extensions.- android: Prior to Oreo, this id (ANDROID_ID) will always be the same once you set up your phone.
- android: Google Play policy, see "persistent device identifiers". Huawei - AppGallery Review Guidelines see "permanent device identifier" and "obtaining user consent".
syncUniqueId()
This method is intended for iOS.
This synchronizes uniqueId with IDFV
or sets new a random string.
On iOS it uses the DeviceUID
uid identifier.
On other platforms it just call getUniqueId()
in this module.
Examples
1DeviceInfo.syncUniqueId().then((uniqueId) => { 2 // iOS: "FCDBD8EF-62FC-4ECB-B2F5-92C9E79AC7F9" 3 // Android: "dd96dec43fb81c97" 4 // Windows: ? 5});
Notes
- If user moved or restored data from one iOS device to second iOS device then he will have two different devices with same
uniqueId
in Keychain/NSUserDefaults. User can callsyncUniqueId()
on new iOS device. That will update hisuniqueId
fromIDFV
or a random string.
getUsedMemory()
Gets the app memory usage, in bytes.
⚠️ A note from the Android docs.
Note: this method is only intended for debugging or building a user-facing process management UI.
Examples
1DeviceInfo.getUsedMemory().then((usedMemory) => { 2 // 23452345 3});
getSupportedMediaTypeList()
This method gets the list of supported media codecs.
Examples
1DeviceInfo.getSupportedMediaTypeList().then((string[]) => { 2 // ["audio/mpeg", "audio/mp4a-latm", "audio/mp4a-latm", "audio/mp4a-latm", "audio/mp4a-latm", "video/avc", "video/3gpp", "video/hevc", "video/mp4v-es", "video/av01", "video/avc", "video/avc", "video/avc", "video/avc"] 3});
getUserAgent()
Gets the device User Agent.
Examples
1DeviceInfo.getUserAgent().then((userAgent) => { 2 // iOS: "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143" 3 // tvOS: not available 4 // Android: "Mozilla/5.0 (Linux; Android 12; sdk_gphone64_arm64 Build/SE1A.220630.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/91.0.4472.114 Mobile Safari/537.36" 5 // Windows: ? 6});
getVersion()
Gets the application version. Take into account that a version string is device/OS formatted and can contain any additional data (such as build number etc.). If you want to be sure about version format, you can use a regular expression to get the desired portion of the returned version string.
Examples
1let version = DeviceInfo.getVersion(); 2// iOS: "1.0" 3// Android: "1.0" or "1.0.2-alpha.12" 4// Windows: ?
isAirplaneMode()
Tells if the device is in Airplane Mode.
Examples
1DeviceInfo.isAirplaneMode().then((airplaneModeOn) => { 2 // false 3});
Notes
- This only works if the remote debugger is disabled.
isBatteryCharging()
Tells if the battery is currently charging.
Examples
1DeviceInfo.isBatteryCharging().then((isCharging) => { 2 // true or false 3});
isEmulator()
Tells if the application is running in an emulator.
Examples
1DeviceInfo.isEmulator().then((isEmulator) => { 2 // false 3});
isKeyboardConnected()
Tells if the device has a keyboard connected.
Examples
1let isKeyboardConnected = DeviceInfo.isKeyboardConnected();
2// true
isPinOrFingerprintSet()
Tells if a PIN number or a fingerprint was set for the device.
Examples
1DeviceInfo.isPinOrFingerprintSet().then((isPinOrFingerprintSet) => { 2 if (!isPinOrFingerprintSet) { 3 // ... 4 } 5});
isTablet()
Tells if the device is a tablet.
Examples
1let isTablet = DeviceInfo.isTablet();
2// true
isLowRamDevice()
Tells if the device has low RAM.
Examples
1let isLowRamDevice = DeviceInfo.isLowRamDevice();
2// true
isDisplayZoomed()
Tells if the user changed Display Zoom to Zoomed
Examples
1let isDisplayZoomed = DeviceInfo.isDisplayZoomed();
2// true
isTabletMode()
Tells if the device is in tablet mode.
Examples
1let isTabletMode = DeviceInfo.isTabletMode();
2// true
isLandscape()
Tells if the device is currently in landscape mode.
Examples
1DeviceInfo.isLandscape().then((isLandscape) => { 2 // true 3});
isMouseConnected()
Tells if the device has a mouse connected.
Examples
1let isMouseConnected = DeviceInfo.isMouseConnected();
2// true
hasGms()
Tells if the device supports Google Mobile Services.
Examples
1DeviceInfo.hasGms().then((hasGms) => { 2 // true 3});
hasHms()
Tells if the device supports Huawei Mobile Services.
Examples
1DeviceInfo.hasHms().then((hasHms) => { 2 // true 3});
hasNotch()
Tells if the device has a notch.
Examples
1let hasNotch = DeviceInfo.hasNotch();
2// true
hasDynamicIsland()
Tells if the device has a dynamic island.
Examples
1let hasDynamicIsland = DeviceInfo.hasDynamicIsland();
2// true
getDeviceType()
Returns the device's type as a string, which will be one of:
Handset
Tablet
Tv
Desktop
GamingConsole
Headset
unknown
Examples
1let type = DeviceInfo.getDeviceType();
2// 'Handset'
supported32BitAbis()
An ordered list of 32 bit ABIs supported by this device.
Examples
1DeviceInfo.supported32BitAbis().then((abis) => { 2 // ["armeabi-v7a", "armeabi"] 3});
supported64BitAbis()
An ordered list of 64 bit ABIs supported by this device.
Examples
1DeviceInfo.supported64BitAbis().then((abis) => { 2 // ["arm64-v8a"] 3});
supportedAbis()
Returns a list of supported processor architecture version
Examples
1DeviceInfo.supportedAbis().then((abis) => { 2 // [ "arm64 v8", "Intel x86-64h Haswell", "arm64-v8a", "armeabi-v7a", "armeabi", "win_x86", "win_arm", "win_x64", "win_arm64", "win_x86onarm64" ]});
hasSystemFeature(feature)
Tells if the device has a specific system feature.
Examples
1DeviceInfo.hasSystemFeature('amazon.hardware.fire_tv').then((hasFeature) => {
2 // true or false
3});
getSystemAvailableFeatures()
Returns a list of available system features on Android.
Examples
1DeviceInfo.getSystemAvailableFeatures().then((features) => { 2 // ["android.software.backup", "android.hardware.screen.landscape", "android.hardware.wifi", ...] 3});
isLocationEnabled()
Tells if the device has location services turned off at the device-level (NOT related to app-specific permissions)
Examples
1DeviceInfo.isLocationEnabled().then((enabled) => { 2 // true or false 3});
isHeadphonesConnected()
Tells if the device is connected to wired headset or bluetooth headphones
Examples
1DeviceInfo.isHeadphonesConnected().then((enabled) => { 2 // true or false 3});
isWiredHeadphonesConnected()
Tells if the device is connected to wired headset
Examples
1DeviceInfo.isWiredHeadphonesConnected().then((enabled) => { 2 // true or false 3});
isBluetoothHeadphonesConnected()
Tells if the device is connected to bluetooth headset
Examples
1DeviceInfo.isBluetoothHeadphonesConnected().then((enabled) => { 2 // true or false 3});
getAvailableLocationProviders()
Returns an object of platform-specfic location providers/servcies, with boolean
value whether or not they are currently available.
NOTE: This function requires access to the Location permission on Android
Android Example
1DeviceInfo.getAvailableLocationProviders().then((providers) => { 2 // { 3 // gps: true 4 // network: true 5 // passive: true 6 // } 7});
iOS Example
1DeviceInfo.getAvailableLocationProviders().then((providers) => { 2 // { 3 // headingAvailable: false 4 // isRangingAvailable: false 5 // locationServicesEnabled: true 6 // significantLocationChangeMonitoringAvailable: true 7 // } 8});
getBrightness()
Gets the current brightness level of the device's main screen. Currently iOS only. Returns a number between 0.0 and 1.0, inclusive.
Examples
1DeviceInfo.getBrightness().then((brightness) => { 2 // iOS: 0.6 3});
Hooks & Events
Supported in Windows, iOS & Android (web support for battery/charging-related APIs).
useBatteryLevel or RNDeviceInfo_batteryLevelDidChange
Fired when the battery level changes; sent no more frequently than once per minute.
Examples
1import { useBatteryLevel } from 'react-native-device-info'; 2 3const batteryLevel = useBatteryLevel(); // 0.759999 4 5<Text>{batteryLevel}</Text>;
1import { NativeEventEmitter, NativeModules } from 'react-native'; 2const deviceInfoEmitter = new NativeEventEmitter(NativeModules.RNDeviceInfo); 3 4deviceInfoEmitter.addListener('RNDeviceInfo_batteryLevelDidChange', (level) => { 5 // 0.759999 6});
useBatteryLevelIsLow or RNDeviceInfo_batteryLevelIsLow
Fired when the battery level is considered low (multiple times untill charged)
Platform | Percentage |
---|---|
iOS | 20 |
Android | 15 |
Web | 20 |
Windows | 20 |
Examples
1import { useBatteryLevelIsLow } from 'react-native-device-info'; 2 3const batteryLevelIsLow = useBatteryLevelIsLow(); // 0.19 4 5<Text>{batteryLevelIsLow}</Text>;
1import { NativeEventEmitter, NativeModules } from 'react-native'; 2const deviceInfoEmitter = new NativeEventEmitter(NativeModules.RNDeviceInfo); 3 4deviceInfoEmitter.addListener('RNDeviceInfo_batteryLevelIsLow', (level) => { 5 // 0.19 6});
usePowerState or RNDeviceInfo_powerStateDidChange
Fired when the battery state changes or device enters in the power saving mode, for example when the device enters charging mode or is unplugged.
Examples
1import { usePowerState } from 'react-native-device-info'; 2 3const powerState = usePowerState(); 4 // { 5 // batteryLevel: 0.759999, 6 // batteryState: 'unplugged', 7 // lowPowerMode: false, 8 // } 9 10<Text>{powerState}</Text>;
1import { NativeEventEmitter, NativeModules } from 'react-native' 2const deviceInfoEmitter = new NativeEventEmitter(NativeModules.RNDeviceInfo) 3 4deviceInfoEmitter.addListener('RNDeviceInfo_powerStateDidChange', { powerState } => { 5 // { 6 // batteryLevel: 0.759999, 7 // batteryState: 'unplugged', 8 // lowPowerMode: false, 9 // } 10});
useFirstInstallTime
Gets the time at which the app was first installed, in milliseconds.
Example
1import { useFirstInstallTime } from 'react-native-device-info'; 2 3const { loading, result } = useFirstInstallTime(); // { loading: true, result: 1517681764528} 4 5<Text>{loading ? 'loading...' : result}</Text>;
useDeviceName
Gets the device name.
Example
1import { useDeviceName } from 'react-native-device-info'; 2 3const { loading, result } = useDeviceName(); // { loading: true, result: "Becca's iPhone 6"} 4 5<Text>{loading ? 'loading...' : result}</Text>;
useHasSystemFeature
Tells if the device has a specific system feature.
Example
1import { useHasSystemFeature } from 'react-native-device-info'; 2 3const { loading, result } = useHasSystemFeature('amazon.hardware.fire_tv'); // { loading: true, result: false } 4 5<Text>{loading ? 'loading...' : result}</Text>;
useIsEmulator
Get whether the application is running in an emulator.
Example
1import { useIsEmulator } from 'react-native-device-info'; 2 3const { loading, result } = useIsEmulator(); // { loading: true, result: false } 4 5<Text>{loading ? 'loading...' : result}</Text>;
useManufacturer
Gets the device manufacturer.
Example
1import { useManufacturer } from 'react-native-device-info'; 2 3const { loading, result } = useManufacturer(); // { loading: true, result: "Apple"} 4 5<Text>{loading ? 'loading...' : result}</Text>;
useIsHeadphonesConnected
Tells if the device is connected to wired headset or bluetooth headphones.
This hook subscribes to the event, RNDeviceInfo_headphoneConnectionDidChange
, and updates the result
field accordingly.
Example
1import { useIsHeadphonesConnected } from 'react-native-device-info'; 2 3const { loading, result } = useIsHeadphonesConnected(); // { loading: true, result: false} 4 5<Text>{loading ? 'loading...' : result}</Text>;
useIsWiredHeadphonesConnected
Tells if the device is connected to wired headset.
This hook subscribes to the event, RNDeviceInfo_headphoneWiredConnectionDidChange
, and updates the result
field accordingly.
Example
1import { useIsWiredHeadphonesConnected } from 'react-native-device-info'; 2 3const { loading, result } = useIsWiredHeadphonesConnected(); // { loading: true, result: false} 4 5<Text>{loading ? 'loading...' : result}</Text>;
useIsBluetoothHeadphonesConnected
Tells if the device is connected to bluetooth headphones.
This hook subscribes to the event, RNDeviceInfo_headphoneBluetoothConnectionDidChange
, and updates the result
field accordingly.
Example
1import { useIsBluetoothHeadphonesConnected } from 'react-native-device-info'; 2 3const { loading, result } = useIsBluetoothHeadphonesConnected(); // { loading: true, result: false} 4 5<Text>{loading ? 'loading...' : result}</Text>;
useBrightness
Gets the current brightness level of the device's main screen. Currently iOS only. Returns a number between 0.0 and 1.0, inclusive.
This hook subscribes to the event, RNDeviceInfo_brightnessDidChange
, and updates the brightness
field accordingly.
Example
1import { useBrightness } from 'react-native-device-info'; 2 3const brightness = useBrightness(); // 0.46578987897654567 4 5<Text>{brightness}</Text>;
1import { NativeEventEmitter, NativeModules } from 'react-native'; 2 3const deviceInfoEmitter = new NativeEventEmitter(NativeModules.RNDeviceInfo); 4 5deviceInfoEmitter.addListener('RNDeviceInfo_brightnessDidChange', (brightness) => { 6 // 0.46578987897654567 7});
=======
Native interoperatibily
If you need to check for device type from the native side, you can use the following:
1import com.learnium.resolver.DeviceTypeResolver 2 3... 4deviceTypeResolver = new DeviceTypeResolver(context); 5... 6//Check if the device is a Tablet: 7if(deviceTypeResolver.isTablet){ 8 ... 9}else{ 10 ... 11}
Troubleshooting
When installing or using react-native-device-info
, you may encounter the following problems:
[android] - Unable to merge dex / Multiple dex files / Problems with `com.google.android.gms`
react-native-device-info
uses com.google.android.gms:play-services-gcm
to provide getInstanceId().
This can lead to conflicts when building the Android application.
If you're using a different version of com.google.android.gms:play-services-gcm
in your app, you can define the
googlePlayServicesVersion
gradle variable in your build.gradle
file to tell react-native-device-info
what version
it should require. See the example project included here for a sample.
If you're using a different library that conflicts with com.google.android.gms:play-services-gcm
, and you are certain you know what you are doing such that you will avoid version conflicts, you can simply
ignore this dependency in your gradle file:
1 compile(project(':react-native-device-info')) { 2 exclude group: 'com.google.android.gms' 3}
[ios] - ld: library not found for -lRNDeviceInfo-tvOS
Seems to be a bug caused by react-native link
. You can manually delete libRNDeviceInfo-tvOS.a
in Xcode -> [Your iOS build target] -> Build Phrases -> Link Binary with Libraries
.
[ios] - [NetworkInfo] Descriptors query returned error: Error Domain=NSCocoaErrorDomain Code=4099 “The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated.”
This is a system level log that may be turned off by executing:
xcrun simctl spawn booted log config --mode "level:off" --subsystem com.apple.CoreTelephony
.
To undo the command, you can execute:
xcrun simctl spawn booted log config --mode "level:info" --subsystem com.apple.CoreTelephony
[ios] - Multiple versions of React when using CocoaPods "tries to require 'react-native' but there are several files providing this module"
RN<=59 You may need to adjust your Podfile like this if you use Cocoapods and have undefined symbols or duplicate React definitions
1target 'yourTargetName' do 2 # See http://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies 3 pod 'React', :path => '../node_modules/react-native', :subspecs => [ 4 'Core', 5 'CxxBridge', # Include this for RN >= 0.47 6 'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43 7 'RCTText', 8 'RCTNetwork', 9 'RCTWebSocket', # Needed for debugging 10 'RCTAnimation', # Needed for FlatList and animations running on native UI thread 11 # Add any other subspecs you want to use in your project 12 ] 13 14 # Explicitly include Yoga if you are using RN >= 0.42.0 15 pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga' 16 17 # Third party deps podspec link - you may have multiple pods here, just an example 18 pod 'RNDeviceInfo', path: '../node_modules/react-native-device-info' 19 20end 21 22# if you see errors about React duplicate definitions, this fixes it. The same works for yoga. 23post_install do |installer| 24 installer.pods_project.targets.each do |target| 25 if target.name == "React" 26 target.remove_from_project 27 end 28 end 29end
[tests] - Cannot run my test suite when using this library
react-native-device-info
contains native code, and needs to be mocked. Jest Snapshot support may work though.
If you do not have a Jest Setup file configured, you should add the following to your Jest settings and create the jest.setup.js file in project root:
1setupFiles: ['<rootDir>/jest.setup.js'];
You should then add the following to your Jest setup file to mock the DeviceInfo Native Module:
1import mockRNDeviceInfo from 'react-native-device-info/jest/react-native-device-info-mock'; 2 3jest.mock('react-native-device-info', () => mockRNDeviceInfo);
Checkout the example project for more information.
[warnings] - I get too many warnings (battery state, etc)
Some of the APIs (like getBatteryState) will throw warnings in certain conditions like on tvOS or the iOS emulator. This won't be visible in production but even in development it may be irritating. It is useful to have the warnings because these devices return no state, and that can be surprising, leading to github support issues. The warnings is intended to educate you as a developer. If the warnings are troublesome you may try this in your code to suppress them:
1import { LogBox } from 'react-native'; 2LogBox.ignoreLogs(['Battery state']);
Release Notes
See the CHANGELOG.md.
Contributing
Please see the contributing guide
.
react-native-dom
As a courtesy to developers, this library was made compatible in v0.21.6 with react-native-dom and react-native-web by providing an empty polyfill in order to avoid breaking builds.
Only getUserAgent() will return a correct value. All other API methods will return an "empty" value of its documented return type: 0
for numbers, ''
for strings, false
for booleans.
No vulnerabilities found.
Reason
21 commit(s) and 26 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
binaries present in source code
Details
- Warn: binary detected: android/gradle/wrapper/gradle-wrapper.jar:1
- Warn: binary detected: example/android/gradle/wrapper/gradle-wrapper.jar:1
Reason
Found 15/29 approved changesets -- score normalized to 5
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/jest-test.yml:1
- Warn: no topLevel permission defined: .github/workflows/linting.yml:1
- Warn: no topLevel permission defined: .github/workflows/pr_title.yml:1
- Warn: no topLevel permission defined: .github/workflows/release.yml:1
- Warn: no topLevel permission defined: .github/workflows/stale.yml:1
- Warn: no topLevel permission defined: .github/workflows/tests_e2e.yml:1
- Warn: no topLevel permission defined: .github/workflows/windows-app-test.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/jest-test.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/jest-test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/jest-test.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/jest-test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/linting.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/linting.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/linting.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/linting.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/linting.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/linting.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/linting.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/linting.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/linting.yml:48: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/linting.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/linting.yml:52: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/linting.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/linting.yml:58: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/linting.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/linting.yml:67: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/linting.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/pr_title.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/pr_title.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/release.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/release.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/stale.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/stale.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/tests_e2e.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/tests_e2e.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests_e2e.yml:49: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/tests_e2e.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests_e2e.yml:54: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/tests_e2e.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests_e2e.yml:62: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/tests_e2e.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests_e2e.yml:69: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/tests_e2e.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/tests_e2e.yml:76: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/tests_e2e.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests_e2e.yml:85: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/tests_e2e.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/tests_e2e.yml:92: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/tests_e2e.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests_e2e.yml:114: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/tests_e2e.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/tests_e2e.yml:121: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/tests_e2e.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests_e2e.yml:178: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/tests_e2e.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests_e2e.yml:206: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/tests_e2e.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests_e2e.yml:223: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/tests_e2e.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/tests_e2e.yml:228: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/tests_e2e.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests_e2e.yml:234: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/tests_e2e.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/tests_e2e.yml:238: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/tests_e2e.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests_e2e.yml:246: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/tests_e2e.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests_e2e.yml:253: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/tests_e2e.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/tests_e2e.yml:260: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/tests_e2e.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/tests_e2e.yml:268: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/tests_e2e.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/tests_e2e.yml:289: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/tests_e2e.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests_e2e.yml:328: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/tests_e2e.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/windows-app-test.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/windows-app-test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/windows-app-test.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/windows-app-test.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/windows-app-test.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/windows-app-test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/windows-app-test.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/windows-app-test.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/windows-app-test.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/windows-app-test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/windows-app-test.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/windows-app-test.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/windows-app-test.yml:48: update your workflow using https://app.stepsecurity.io/secureworkflow/react-native-device-info/react-native-device-info/windows-app-test.yml/master?enable=pin
- Info: 0 out of 28 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 15 third-party GitHubAction dependencies pinned
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 19 are checked with a SAST tool
Reason
47 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-c2jc-4fpr-4vhg
- Warn: Project is vulnerable to: GHSA-crh6-fp67-6883
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-4w2v-q235-vp99
- Warn: Project is vulnerable to: GHSA-cph5-m8f7-6c5x
- Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc
- Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp
- Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q
- Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c
- Warn: Project is vulnerable to: GHSA-7mhc-prgv-r3q4
- Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-w7q9-p3jq-fmhm
- Warn: Project is vulnerable to: GHSA-xvf7-4v9q-58w6
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m / GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-8hfj-j24r-96c4
- Warn: Project is vulnerable to: GHSA-wc69-rhjr-hc9g
- Warn: Project is vulnerable to: GHSA-56x4-j7p9-fcf9
- Warn: Project is vulnerable to: GHSA-v78c-4p63-2j6c
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-x565-32qp-m3vf
- Warn: Project is vulnerable to: GHSA-rxrc-rgv4-jpvx
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-rv73-9c8w-jp4c
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-776f-qx25-q3cc
- Warn: Project is vulnerable to: GHSA-5fg8-2547-mr8q
- Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693
Score
4.1
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to react-native-device-info
@rescript-react-native/device-info
ReScript bindings for react-native-device-info.
@ux-monster/react-native-uikit
``` yarn add react-native-reanimated yarn add react-native-device-info yarn add react-native-gesture-handler ```
@reason-react-native/device-info
ReScript/Reason bindings for react-native-device-info
@react-native-community/cli-platform-android
This package is part of the [React Native CLI](../../README.md). It contains commands for managing the Android part of React Native app.