0.1.9 • Published 6 months ago

@focus8/expo-vendor-system-tools v0.1.9

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

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-tools

Or if you're not using Expo Go:

npm install expo-vendor-system-tools

Then:

npx react-native link expo-vendor-system-tools

You 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 su binary (requires rooted device)
  • Android system services like AudioManager and PowerManager

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

0.1.9

6 months ago

0.1.8

7 months ago

0.1.6

7 months ago

0.1.5

7 months ago

0.1.4

7 months ago

0.1.3

7 months ago

0.1.2

7 months ago

0.1.1

7 months ago

0.1.0

7 months ago