@rick427/react-native-developer-mode
v1.1.0
Published
A lightweight React Native library to detect if developer mode is enabled on Android and iOS.
Maintainers
Readme
react-native-developer-mode
A simple, lightweight React Native library that detects whether Developer Mode (Android Developer Options / iOS Developer Mode) is active on the device — including real-time detection while the app is running.
Features
- ✅ Android: Detects Developer Options and USB debugging (ADB)
- ✅ iOS 16+: Detects Developer Mode via Apple's
DeviceCheckframework - ✅ Real-time listener — catches users who enable dev mode while the app is open or backgrounded
- ✅ Zero dependencies
- ✅ Fully typed (TypeScript)
- ✅ Promise-based async API
Installation
npm install @rick427/react-native-developer-mode
# or
yarn add @rick427/react-native-developer-modeiOS
cd ios && pod installAndroid
No extra steps required — the module is auto-linked.
Usage
One-shot read
import { isDeveloperModeEnabled, checkDeveloperMode } from '@rick427/react-native-developer-mode';
// Full result object
const result = await isDeveloperModeEnabled();
console.log(result.isDeveloperModeEnabled); // true | false
console.log(result.isAdbEnabled); // true | false (Android only)
// Simple boolean helper
const isDevMode = await checkDeveloperMode();
console.log(isDevMode); // true | falseReal-time listener
Subscribe to changes so your app reacts the moment a user enables developer mode — even if they do it while the app is backgrounded.
import { useEffect } from 'react';
import { addDeveloperModeListener } from '@rick427/react-native-developer-mode';
useEffect(() => {
const subscription = addDeveloperModeListener((result) => {
if (result.isDeveloperModeEnabled) {
// warn the user, log the event, or take protective action
console.warn('Developer mode was enabled!');
}
});
// Always clean up to avoid memory leaks
return () => subscription.remove();
}, []);API
isDeveloperModeEnabled(): Promise<DeveloperModeResult>
Reads the current state once. Returns a promise that resolves with:
| Field | Type | Description |
|---|---|---|
| isDeveloperModeEnabled | boolean | Whether Developer Options (Android) or Developer Mode (iOS 16+) is enabled |
| isAdbEnabled | boolean | Whether USB debugging (ADB) is enabled. Android only — always false on iOS |
checkDeveloperMode(): Promise<boolean>
Convenience helper. Resolves to true if developer mode is active on the current platform.
addDeveloperModeListener(callback): EmitterSubscription
Subscribes to real-time developer-mode state changes. Returns an EmitterSubscription — call .remove() to unsubscribe.
| Parameter | Type | Description |
|---|---|---|
| callback | (result: DeveloperModeResult) => void | Called whenever the developer-mode state changes |
Platform behaviour
| Scenario | Android | iOS |
|---|---|---|
| App open, dev mode toggled | ✅ Fires immediately via ContentObserver | ⚠️ Fires on next foreground |
| App backgrounded, dev mode toggled, app foregrounded | ✅ Fires immediately on toggle | ✅ Fires on foreground |
| App cold-started after dev mode was already on | ✅ One-shot read returns true | ✅ One-shot read returns true |
Android uses a
ContentObserveron the system settings URI — it fires the instant the value changes in the settings database, regardless of app state.iOS has no system-level callback for this setting. The listener re-checks
DCDevice.currentDevice.developerModeEnabledevery time the app comes back to the foreground and only emits if the value changed.
Platform Notes
Android
Reads the following system settings (no permissions required):
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED— whether Developer Options is turned onSettings.Global.ADB_ENABLED— whether USB debugging is enabled
Requires API 16 (Android 4.1) or above.
iOS
Uses DCDevice.currentDevice.developerModeEnabled from Apple's DeviceCheck framework.
- iOS 16+: Returns the real value from the system.
- iOS < 16: Returns
false(Developer Mode did not exist as a setting before iOS 16).
Authors
License
MIT © Richard Njoku
