@focus8/expo-vendor-system-tools
v0.1.15
Published
Various system tools for working with Android in Expo
Readme
expo-vendor-system-tools
Native module for interacting with low-level Android system features via Expo/React Native – with support for root-enabled operations.
Features
- Turn screen on/off (requires root)
- Reboot or shut down device (requires root)
- Simulate sleep/wake key events
- Set system audio volume levels
- Get device serial number
- React to screen on/off state in JS
Requirements
- Android device
- Expo development environment
- Root access for most system-level operations
Installation
npx expo install expo-vendor-system-toolsOr if you're not using Expo Go:
npm install expo-vendor-system-toolsThen:
npx react-native link expo-vendor-system-toolsYou must use a custom development client to access native functionality. See Expo Dev Client for details.
Usage
Basic API
import ExpoVendorSystemTools from "expo-vendor-system-tools";
await ExpoVendorSystemTools.turnOffScreenAsync();
await ExpoVendorSystemTools.turnOnScreenAsync();
await ExpoVendorSystemTools.rebootDeviceAsync();
await ExpoVendorSystemTools.shutdownDeviceAsync();
await ExpoVendorSystemTools.wakeUpDeviceAsync();
await ExpoVendorSystemTools.sleepDeviceAsync();
const serial = ExpoVendorSystemTools.getSerialNumber();
const isRoot = ExpoVendorSystemTools.isRootAvailable();
const volumeSet = ExpoVendorSystemTools.setVolumeLevels();Listen to Screen Events
import { useScreenState } from "expo-vendor-system-tools";
const isScreenOn = useScreenState();This hook internally listens for the native onScreenStateChange event which is triggered when the screen turns on or off.
Permissions
This module uses:
- Shell access via
subinary (requires rooted device) - Android system services like
AudioManagerandPowerManager
No additional manifest permissions are currently required, but the app must be granted superuser access on rooted devices.
Notes
- Many functions will silently fail on non-rooted devices.
- This module is Android-only.
- Built with
expo-modules, and compatible with the Expo Dev Client.
Development
This module is implemented in Kotlin using the new expo-modules system. See the source under android/ for more.
License
MIT
