npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dahmaular/react-native-device-info-sdk

v1.0.0

Published

A comprehensive React Native SDK for getting device information including battery status on both Android and iOS

Downloads

10

Readme

React Native Device Info SDK

A comprehensive React Native SDK for getting detailed device information including battery status, system info, hardware details, network information, security status, and display properties on both Android and iOS platforms.

Features

  • Battery Information: Level, charging status, health, temperature, voltage
  • System Information: OS version, device model, build info, kernel version
  • Hardware Information: Memory, storage, sensors, camera info, capabilities
  • Network Information: Connection type, WiFi details, cellular info, IP address
  • Security Information: Screen lock, root/jailbreak detection, biometric capabilities
  • Display Information: Screen dimensions, density, orientation, brightness
  • Real-time Monitoring: Battery and network state change events
  • Performance Optimized: Caching and background processing
  • TypeScript Support: Full type definitions included

Installation

npm install react-native-device-info-sdk
# or
yarn add react-native-device-info-sdk

iOS Setup

  1. Run pod install:
cd ios && pod install
  1. Add the following permissions to your Info.plist if you want full functionality:
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app needs location access to determine network information.</string>

Android Setup

The following permissions are automatically added to your AndroidManifest.xml:

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
<uses-permission android:name="android.permission.BATTERY_STATS" />

Usage

Basic Usage

import { getDeviceInfo, getBatteryInfo } from 'react-native-device-info-sdk';

// Get all device information
const deviceInfo = await getDeviceInfo();
console.log('Device Info:', deviceInfo);

// Get battery information only
const batteryInfo = await getBatteryInfo();
console.log('Battery Info:', batteryInfo);

Battery Information

import { getBatteryInfo, startBatteryMonitoring, stopBatteryMonitoring } from 'react-native-device-info-sdk';
import { DeviceEventEmitter } from 'react-native';

// Get current battery info
const battery = await getBatteryInfo();
console.log('Battery Level:', battery.batteryLevel);
console.log('Is Charging:', battery.isCharging);
console.log('Battery Status:', battery.batteryStatus);

// Start monitoring battery changes
await startBatteryMonitoring();

const batteryListener = DeviceEventEmitter.addListener('BatteryStateChanged', (event) => {
  console.log('Battery changed:', event.battery);
});

// Stop monitoring
await stopBatteryMonitoring();
batteryListener.remove();

System Information

import { getSystemInfo } from 'react-native-device-info-sdk';

const systemInfo = await getSystemInfo();
console.log('Platform:', systemInfo.platform);
console.log('OS Version:', systemInfo.osVersion);
console.log('Device Model:', systemInfo.deviceModel);
console.log('Device Brand:', systemInfo.deviceBrand);

Hardware Information

import { getHardwareInfo, getCameraInfo, getSensorList } from 'react-native-device-info-sdk';

const hardware = await getHardwareInfo();
console.log('Total Memory:', hardware.totalMemory);
console.log('Available Storage:', hardware.availableStorage);
console.log('Has NFC:', hardware.hasNFC);
console.log('Has Fingerprint:', hardware.hasFingerprint);

const cameras = await getCameraInfo();
console.log('Cameras:', cameras);

const sensors = await getSensorList();
console.log('Available Sensors:', sensors);

Network Information

import { getNetworkInfo, startNetworkMonitoring } from 'react-native-device-info-sdk';

const network = await getNetworkInfo();
console.log('Connection Type:', network.connectionType);
console.log('Is Connected:', network.isConnected);
console.log('WiFi SSID:', network.wifiSSID);
console.log('IP Address:', network.ipAddress);

Security Information

import { getSecurityInfo, checkDeviceIntegrity } from 'react-native-device-info-sdk';

const security = await getSecurityInfo();
console.log('Is Device Secure:', security.isDeviceSecure);
console.log('Has Screen Lock:', security.hasScreenLock);
console.log('Is Jailbroken/Rooted:', security.isJailbroken || security.isRooted);
console.log('Is Emulator:', security.isEmulator);
console.log('Supported Biometrics:', security.supportedBiometrics);

const isIntegrityOk = await checkDeviceIntegrity();
console.log('Device Integrity:', isIntegrityOk);

Display Information

import { getDisplayInfo, getBrightness } from 'react-native-device-info-sdk';

const display = await getDisplayInfo();
console.log('Screen Width:', display.screenWidth);
console.log('Screen Height:', display.screenHeight);
console.log('Density:', display.density);
console.log('Orientation:', display.orientation);
console.log('Has Notch:', display.hasNotch);

const brightness = await getBrightness();
console.log('Current Brightness:', brightness);

Advanced Usage with Options

import DeviceInfoManager from 'react-native-device-info-sdk';

const manager = DeviceInfoManager.getInstance({
  enableBatteryMonitoring: true,
  enableNetworkMonitoring: true,
  cacheDuration: 30000, // Cache for 30 seconds
  includeSystemInfo: true,
  includeHardwareInfo: true,
  includeNetworkInfo: true,
  includeSecurityInfo: true,
  includeDisplayInfo: true,
  includeBatteryInfo: true,
});

const deviceInfo = await manager.getDeviceInfo();

API Reference

Methods

getDeviceInfo(options?: DeviceInfoSDKOptions): Promise<DeviceInfo>

Returns comprehensive device information including all categories.

getBatteryInfo(): Promise<BatteryInfo>

Returns detailed battery information.

getSystemInfo(): Promise<SystemInfo>

Returns system and OS information.

getHardwareInfo(): Promise<HardwareInfo>

Returns hardware specifications and capabilities.

getNetworkInfo(): Promise<NetworkInfo>

Returns network connection information.

getSecurityInfo(): Promise<SecurityInfo>

Returns security-related information.

getDisplayInfo(): Promise<DisplayInfo>

Returns display properties and screen information.

getCameraInfo(): Promise<CameraInfo[]>

Returns information about available cameras.

getSensorList(): Promise<string[]>

Returns list of available sensors.

getBrightness(): Promise<number>

Returns current screen brightness (0-1).

startBatteryMonitoring(): Promise<void>

Starts monitoring battery state changes.

stopBatteryMonitoring(): Promise<void>

Stops monitoring battery state changes.

startNetworkMonitoring(): Promise<void>

Starts monitoring network state changes.

stopNetworkMonitoring(): Promise<void>

Stops monitoring network state changes.

checkDeviceIntegrity(): Promise<boolean>

Checks if the device has been compromised (rooted/jailbroken).

clearCache(): void

Clears the internal cache.

Events

BatteryStateChanged

Emitted when battery state changes (when monitoring is enabled).

DeviceEventEmitter.addListener('BatteryStateChanged', (event) => {
  console.log('Battery info:', event.battery);
  console.log('Timestamp:', event.timestamp);
});

NetworkStateChanged

Emitted when network state changes (when monitoring is enabled).

DeviceEventEmitter.addListener('NetworkStateChanged', (event) => {
  console.log('Network info:', event.network);
  console.log('Timestamp:', event.timestamp);
});

Types

The SDK includes comprehensive TypeScript definitions for all return types:

  • DeviceInfo - Complete device information
  • BatteryInfo - Battery status and health
  • SystemInfo - OS and device information
  • HardwareInfo - Hardware specifications
  • NetworkInfo - Network connection details
  • SecurityInfo - Security status
  • DisplayInfo - Screen and display properties
  • CameraInfo - Camera specifications
  • DeviceInfoSDKOptions - Configuration options

Example Response

{
  "system": {
    "platform": "ios",
    "osVersion": "16.4",
    "deviceModel": "iPhone14,2",
    "deviceBrand": "Apple",
    "deviceName": "iPhone 13 Pro"
  },
  "battery": {
    "batteryLevel": 85,
    "batteryStatus": "discharging",
    "isCharging": false,
    "isFull": false,
    "isLow": false,
    "health": "good",
    "technology": "Li-ion"
  },
  "hardware": {
    "totalMemory": 6442450944,
    "availableMemory": 2147483648,
    "totalStorage": 128849018880,
    "hasNFC": true,
    "hasFaceID": true,
    "cameras": [
      {
        "id": "0",
        "position": "back",
        "hasFlash": true
      }
    ]
  },
  "network": {
    "isConnected": true,
    "connectionType": "wifi",
    "wifiSSID": "\"MyWiFi\"",
    "ipAddress": "192.168.1.100"
  },
  "security": {
    "isDeviceSecure": true,
    "hasScreenLock": true,
    "isJailbroken": false,
    "supportedBiometrics": ["face"]
  },
  "display": {
    "screenWidth": 390,
    "screenHeight": 844,
    "density": 3.0,
    "brightness": 0.8,
    "orientation": "portrait"
  }
}

Platform Differences

Some features are platform-specific:

iOS Only

  • hasTouchID, hasFaceID
  • isJailbroken
  • Detailed utsname information

Android Only

  • isRooted, hasFingerprint
  • isAdbEnabled, isDeveloperModeEnabled
  • Detailed build information (fingerprint, bootloader, etc.)
  • Battery temperature and voltage
  • Detailed cellular information

Performance Considerations

  • The SDK uses intelligent caching to avoid repeated native calls
  • Heavy operations are performed on background threads
  • Network and location-based features require appropriate permissions
  • Battery monitoring should be stopped when not needed to preserve battery life

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library