About React Native Nitro Device Info
React Native Nitro Device Info is an MCP server published by l2hyunwoo in the Developer Tools category: device Info at the Speed of Nitro ⚡️.
The repository has 186 stars and 10 forks, with the last commit 7 days ago. Recent commit activity is the strongest signal that reported issues will get attention.
Install
git clone https://github.com/l2hyunwoo/react-native-nitro-device-infoThis server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.
Tools (3)
get_apiDetailed info about a specific API
Parameters not published.
list_apisList APIs by category/platform/type
Parameters not published.
search_docsNatural language documentation search
Parameters not published.
Ask AI
Ask AI about React Native Nitro Device Info
Powered by Claude · Grounded in docs
Security checks
Static checks derived from the repository 4 hours ago. Heuristics on the source, not an audit.
- ✓README presentThe repository ships documentation.
- ✓License declaredUsable under a stated license.
- ✓Tests presentA test suite exists in the repository.
- ✓Dependencies pinnedA lockfile pins dependency versions.
- !No dynamic code executionSource scan found eval or shell execution. Review how tool inputs reach it before granting credentials.
- !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.
Releases
README
react-native-nitro-device-info
Get comprehensive device information for React Native using Nitro Modules
A high-performance device information library for React Native, built on Nitro Modules for zero-overhead native access through JSI.
Features
- 🚀 Zero-overhead JSI bindings - Direct JavaScript-to-native communication
- 📱 100+ device properties - Comprehensive device information
- 📦 TypeScript-first - Full type definitions included
- 🔄 Drop-in compatible - Bundled compat layer + codemod for
react-native-device-info; familiarexpo-deviceAPIs too
Installation
# Using npm
npm install react-native-nitro-device-info react-native-nitro-modules
# Using yarn
yarn add react-native-nitro-device-info react-native-nitro-modules
# Using pnpm
pnpm add react-native-nitro-device-info react-native-nitro-modules
Note:
react-native-nitro-modules>=0.35.0 <1.0.0 is required as a peer dependency.
iOS Setup
cd ios && pod install && cd ..
v1.9.0: Privacy manifest bundling is available from
1.9.0and is not included in1.8.3. See PR #144.
The pod includes PrivacyInfo.xcprivacy in NitroDeviceInfo_privacy.bundle, including for Expo prebuild / EAS builds. No privacy-specific config plugin option is needed. See iOS Privacy Manifest for the declared API reasons and usage limits.
Upgrading to v1.9.0: An unavailable iOS battery reading changes from
0to-1; a known empty battery remains0.useBatteryLevel()anduseBatteryLevelIsLow()returnnullwhen unavailable. Reinstall pods and rebuild native apps for the iOS capability, privacy-manifest, and Android audio fixes. See the release notes.
Android Setup
No additional configuration needed! Gradle auto-linking handles everything.
Expo (prebuild / dev client)
Use an Expo development build; Expo Go does not include this native module. Rebuild the app after installation or native configuration changes.
npx expo install react-native-nitro-device-info react-native-nitro-modules
Autolinking is enough for most APIs. A few APIs that need a permission or entitlement are opt-in via a config plugin in app.json:
{
"expo": {
"plugins": [
["react-native-nitro-device-info", { "enableSerialNumber": true }]
]
}
}
Then run npx expo prebuild --clean. See the Expo Setup guide for all options, the device-integrity plugin, and the isSideLoadingEnabled() caveat.
Quick Start
The root export uses native properties and methods. To keep react-native-device-info 15.x-style function calls, use react-native-nitro-device-info/compat. Review the migration caveats.
Synchronous calls do not guarantee a particular latency. Battery getters return -1 when unavailable; battery hooks return null. Use React hooks for changing values.
Basic Usage
import { DeviceInfoModule } from 'react-native-nitro-device-info';
// Synchronous properties
console.log(DeviceInfoModule.deviceId); // "iPhone14,2"
console.log(DeviceInfoModule.systemVersion); // "15.0"
console.log(DeviceInfoModule.brand); // "Apple"
console.log(DeviceInfoModule.model); // "iPhone 13 Pro"
// Synchronous properties
const uniqueId = DeviceInfoModule.uniqueId;
console.log(uniqueId); // "FCDBD8EF-62FC-4ECB-B2F5-92C9E79AC7F9"
const manufacturer = DeviceInfoModule.manufacturer;
console.log(manufacturer); // "Apple"
const isTablet = DeviceInfoModule.isTablet;
console.log(isTablet); // false
// Returns -1 when unavailable; useBatteryLevel() returns null.
const batteryLevel = DeviceInfoModule.getBatteryLevel();
console.log(`Battery: ${batteryLevel >= 0 ? `${(batteryLevel * 100).toFixed(0)}%` : 'unavailable'}`); // "Battery: 85%"
// Asynchronous methods (use inside an async function)
const ipAddress = await DeviceInfoModule.getIpAddress();
console.log(ipAddress); // "192.168.1.100"
const carrier = await DeviceInfoModule.getCarrier();
console.log(carrier); // "T-Mobile"
Advanced Usage
import { DeviceInfoModule } from 'react-native-nitro-device-info';
import type { PowerState, DeviceType } from 'react-native-nitro-device-info';
// Device Identification
const deviceId = DeviceInfoModule.deviceId; // "iPhone14,2"
const manufacturer = DeviceInfoModule.manufacturer; // "Apple"
const uniqueId = DeviceInfoModule.uniqueId; // "FCDBD8EF-..."
// Device Capabilities
const isTablet = DeviceInfoModule.isTablet; // false
const hasNotch = DeviceInfoModule.getHasNotch(); // true
const hasDynamicIsland = DeviceInfoModule.getHasDynamicIsland(); // false
const isCameraPresent = DeviceInfoModule.isCameraPresent; // iOS: camera hardware present; false on simulator, no permission prompt
const isPinOrFingerprintSet = DeviceInfoModule.isPinOrFingerprintSet; // iOS: passcode or biometrics available; no authentication prompt
const isEmulator = DeviceInfoModule.isEmulator; // false
const deviceYearClass = DeviceInfoModule.deviceYearClass; // 2021 (estimated year class)
// System Resources
const resourceReadStartedAt = DeviceInfoModule.getUptime();
const totalMemory = DeviceInfoModule.totalMemory;
const usedMemory = DeviceInfoModule.getUsedMemory();
const totalDisk = DeviceInfoModule.totalDiskCapacity;
const freeDisk = DeviceInfoModule.getFreeDiskStorage();
console.log(
`RAM: ${(usedMemory / 1024 / 1024).toFixed(0)}MB / ${(totalMemory / 1024 / 1024).toFixed(0)}MB`
);
console.log(
`Storage: ${(freeDisk / 1024 / 1024 / 1024).toFixed(1)}GB free of ${(totalDisk / 1024 / 1024 / 1024).toFixed(1)}GB`
);
console.log(
`Resource reads took ${DeviceInfoModule.getUptime() - resourceReadStartedAt}ms`
);
// Battery Information
// Returns -1 when unavailable; useBatteryLevel() returns null.
const batteryLevel = DeviceInfoModule.getBatteryLevel();
const isCharging = DeviceInfoModule.getIsBatteryCharging();
const powerState: PowerState = DeviceInfoModule.getPowerState();
console.log(
`Battery: ${batteryLevel >= 0 ? `${(batteryLevel * 100).toFixed(0)}%` : 'unavailable'} ${isCharging ? '(charging)' : ''}`
);
console.log(`Low Power Mode: ${powerState.lowPowerMode}`);
// Application Metadata
const version = DeviceInfoModule.version;
const buildNumber = DeviceInfoModule.buildNumber;
const bundleId = DeviceInfoModule.bundleId;
const appName = DeviceInfoModule.applicationName;
console.log(`${appName} (${bundleId})`);
console.log(`Version: ${version} (${buildNumber})`);
// Network & Connectivity (Async)
const ipAddress = await DeviceInfoModule.getIpAddress();
const carrier = await DeviceInfoModule.getCarrier();
const isLocationEnabled = await DeviceInfoModule.isLocationEnabled();
console.log(`IP: ${ipAddress}`);
console.log(`Carrier: ${carrier}`);
console.log(`Location Services: ${isLocationEnabled ? 'enabled' : 'disabled'}`);
// Platform-Specific
const apiLevel = DeviceInfoModule.apiLevel; // Android: 33, iOS: -1
const abis = DeviceInfoModule.supportedAbis; // ["arm64-v8a"]
const hasGms = DeviceInfoModule.getHasGms(); // Android only
const canSideload = DeviceInfoModule.isSideLoadingEnabled(); // Android only
// Device Integrity (Root/Jailbreak Detection) - Local detection only
const isCompromised = DeviceInfoModule.isDeviceCompromised(); // Sync, <50ms
const isCompromisedAsync = await DeviceInfoModule.verifyDeviceIntegrity(); // Async
Android MAC address getters share a 5-second cache and return "unknown" when access is restricted or the Wi-Fi address is unavailable.
Android headphone detection distinguishes wired/USB headsets (USB on API 26+) from Bluetooth; async and sync getters use the same detection.
Need server-verifiable attestation? The local checks above are bypassable. For hardware-backed, server-verified attestation (Play Integrity on Android, App Attest / DeviceCheck on iOS), use the opt-in
react-native-nitro-device-integritypackage. It issues tokens your backend verifies — see its README.
API Reference
For complete API documentation with all 100+ methods and properties, see API Reference (English).
API sections show introduction-version and platform badges. Read the badge definitions to distinguish OS minimums, limited support, fallbacks, and unreleased implementations.
Quick Reference
Core Properties (Synchronous)
DeviceInfoModule.deviceId; // "iPhone14,2"
DeviceInfoModule.brand; // "Apple"
DeviceInfoModule.systemVersion; // "15.0"
DeviceInfoModule.model; // "iPhone 13 Pro"
Common Properties
// Device Info
DeviceInfoModule.uniqueId; // Sync
DeviceInfoModule.isTablet; // Sync
DeviceInfoModule.totalMemory; // Sync
DeviceInfoModule.getBatteryLevel(); // Sync method
DeviceInfoModule.deviceYearClass; // Sync - estimated device year class
DeviceInfoModule.getUptime(); // Sync - clock for elapsed time between app events
// App Info
DeviceInfoModule.version; // Sync
DeviceInfoModule.bundleId; // Sync
// Platform (Android)
DeviceInfoModule.isSideLoadingEnabled(); // Sync - check sideloading permission
// Network (Async methods)
await DeviceInfoModule.getIpAddress(); // Promise<string>
await DeviceInfoModule.getCarrier(); // Promise<string>
For the complete list of all methods, properties, and detailed documentation, see API Reference (English).
Type Definitions
The library includes full TypeScript definitions. For complete type documentation, see Type Definitions (English).
import type {
DeviceInfo,
PowerState,
BatteryState,
DeviceType,
} from 'react-native-nitro-device-info';
Migration from react-native-device-info
Use the bundled /compat entry point to migrate react-native-device-info (RNDI) 15.x imports. It adapts function signatures and hook result shapes so call sites can stay unchanged. Platform behavior can differ, and some APIs return placeholders. Review the compatibility caveats and test the APIs your app uses.
# 1. Install
npm install react-native-nitro-device-info react-native-nitro-modules
cd ios && pod install && cd ..
# 2. Rewrite imports automatically (call sites untouched)
npx react-native-nitro-device-info migrate
# 3. Remove the old dependency
npm uninstall react-native-device-info
The codemod rewrites every react-native-device-info import to
react-native-nitro-device-info/compat:
// Before
import DeviceInfo from 'react-native-device-info';
import { getModel, useBatteryLevel } from 'react-native-device-info';
// After (rewritten for you — usage is identical)
import DeviceInfo from 'react-native-nitro-device-info/compat';
import { getModel, useBatteryLevel } from 'react-native-nitro-device-info/compat';
The compat layer targets RNDI 15.x; a handful of deprecated/unavailable APIs return
documented placeholder values. Want maximum performance? The native API (DeviceInfoModule) offers
direct property access and synchronous getters. See the
Migration Guide for the
full mapping, caveats, and the optional native-API path.
Acknowledgement
Example Apps
This repository includes three example applications to help you get started and test the library:
Showcase App (example/showcase/)
A simple, single-screen app that displays comprehensive device information.
Purpose: Demonstrates the library's API and displays all available device properties.
Running the showcase app:
# From repository root
yarn showcase start # Start Metro bundler
yarn showcase ios # Run on iOS
yarn showcase android # Run on Android
# Or from the showcase directory
cd example/showcase
yarn start # Start Metro bundler
yarn ios # Run on iOS
yarn android # Run on Android
Benchmark App (example/benchmark/)
An independent performance testing application for benchmarking the Nitro module.
Purpose: Performance testing, stress testing, and comparison with alternative implementations.
Running the benchmark app:
# From repository root
yarn benchmark start # Start Metro bundler
yarn benchmark ios # Run on iOS
yarn benchmark android # Run on Android
# Or from the benchmark directory
cd example/benchmark
yarn start # Start Metro bundler
yarn ios # Run on iOS
yarn android # Run on Android
Integrity Demo App (example/integrity-demo/)
A demo for the opt-in
react-native-nitro-device-integrity
package. It issues attestation tokens (Play Integrity / App Attest /
DeviceCheck) and shows them on screen — verification is left to your server, by
design.
Running the integrity demo app:
# From repository root
yarn integrity-demo start # Start Metro bundler
yarn integrity-demo ios # Run on iOS (real device required for App Attest)
yarn integrity-demo android # Run on Android (needs Google Play Services)
For more details, see:
MCP Server for AI Integration
Enable AI tools like Claude, Cursor, and Copilot to access accurate library documentation through the MCP (Model Context Protocol) server.
Quick Setup (Recommended)
Run the init command in your React Native project to automatically configure MCP for Cursor and Claude Code:
cd your-react-native-project
npx @react-native-nitro-device-info/mcp-server init
This creates:
.cursor/mcp.json- Cursor IDE configuration.mcp.json- Claude Code project configuration
Then restart your IDE and start asking questions!
Manual Configuration
Claude Desktop
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"nitro-device-info": {
"command": "npx",
"args": ["@react-native-nitro-device-info/mcp-server"]
}
}
}
After saving, restart Claude Desktop completely (Cmd+Q, then reopen).
Cursor IDE
Create .cursor/mcp.json in your project root:
{
"mcpServers": {
"nitro-device-info": {
"command": "npx",
"args": ["@react-native-nitro-device-info/mcp-server"]
}
}
}
Available Tools
| Tool | Purpose | Example Query |
|---|---|---|
search_docs |
Natural language documentation search | "how to get device model" |
get_api |
Detailed info about a specific API | "show me getBatteryLevel" |
list_apis |
List APIs by category/platform/type | "list all network APIs" |
Then ask your AI: "How do I get the device's battery level with react-native-nitro-device-info?"
For complete MCP server documentation, see packages/mcp-server/README.md.
Platform Support
- iOS: 15.1+
- Android: API 24+ (Android 7.0 Nougat)
- Web: import-safe fallback (see below)
Web support
Nitro is a JSI/native technology, so there is no native module in a browser. To keep apps that target both native and web (react-native-web, Next.js SSR) buildable, this package ships a pure-JS web fallback that is selected automatically by your bundler — there is no separate package to install and no import path to change.
// Same import on every platform.
import { DeviceInfoModule } from 'react-native-nitro-device-info';
// On web this returns a fallback value instead of throwing.
console.log(DeviceInfoModule.systemLanguage); // e.g. "en-US" from navigator.language
console.log(DeviceInfoModule.deviceId); // "unknown" — not available in a browser
The fallback's goal is "does not crash, and returns honest values" — not "does
everything." Where a browser API can answer, it does; everything else returns the
same neutral constants the native side uses for an unsupported platform
("unknown" / -1 / false / []). Values are never fabricated to look real.
Derived from a real browser API (when available, otherwise the fallback):
| Member | Source |
|---|---|
systemName |
parsed from navigator.userAgent ("Windows"/"macOS"/"iOS"/"Android"/"Linux", else "web") |
systemLanguage |
navigator.language |
brand, manufacturer |
navigator.vendor |
totalMemory |
navigator.deviceMemory × 1024³ (coarse, spec-bucketed; -1 if unsupported) |
getIsLandscape() |
screen.width > screen.height |
getUserAgent() |
navigator.userAgent |
getBatteryLevel(), getPowerState(), getIsBatteryCharging() |
Battery Status API (navigator.getBattery()), requested once; getters read the live BatteryManager; -1/unknown if the API is absent or denied |
getIsAirplaneMode() |
false (unsupported: browsers cannot determine airplane mode) |
Always a fallback constant on web: all Android Build.* fields, carrier/MNC/MCC
info, disk/used-memory figures, headphone/location/notch checks, integrity checks
(isDeviceCompromised() → false), app metadata (version/bundleId/…), and the
Windows-only fields. Promise-returning methods keep their signature and resolve
the fallback (they do not reject), except getDeviceToken() which rejects on web —
it is Apple DeviceCheck, with no web equivalent, mirroring its behavior on Android.
SSR: the web implementation guards browser globals and returns fallbacks on
servers without them. This applies only when the server bundle selects the web
implementation. Reading properties, calling methods, or calling createDeviceInfo()
through the native entry still requires native bindings and can throw. See
Web Support.
Contributing
See CONTRIBUTING.md for development workflow and guidelines.
License
MIT © HyunWoo Lee
Made with ❤️ using Nitro Modules
README fetched from the repository 4 hours ago. The original is authoritative.