Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

JavaScript Bridge API Reference

The global dioxamine object provides asynchronous methods for interacting with connected devices, native dialogs, file systems, and the Android host. Device operations are organized into dedicated namespaces:

  • dioxamine.adb.*: ADB device operations (shell, sync, port forwarding).
  • dioxamine.fastboot.*: Fastboot bootloader operations (variables, raw commands, flash, boot, reboot).
  • dioxamine.tempFile.*: Session-scoped temporary file streaming API.
  • dioxamine.*: Common UI dialogs, file pickers, theming, logging, and HTTP client.

Bridge Initialization

The native bridge is loaded automatically before any plugin scripts execute. To guarantee readiness across all initialization states, listen for the dioxamine-bridge-ready event:

function initPlugin() {
    console.log("Dioxamine Bridge is ready:", window.dioxamine);
}

if (window.dioxamine && window.__dioxamine_bridge_ready) {
    initPlugin();
} else {
    window.addEventListener('dioxamine-bridge-ready', initPlugin, { once: true });
}

API Modules

The API is organized into the following specialized modules:

  1. ADB Device Management: Query the active ADB connection status via dioxamine.adb.getActiveDevice().
  2. ADB Single Command Execution: Run non-interactive commands via dioxamine.adb.shellExec().
  3. ADB Interactive Shell Sessions: Open persistent bi-directional PTY streams via dioxamine.adb.openInteractiveShell().
  4. File Operations and Temporary Storage: Pull/push files via dioxamine.adb.pull() / dioxamine.adb.push(), open system file pickers via dioxamine.requestFilePicker(), and stream payloads to disk using session-scoped temporary files via dioxamine.tempFile.create().
  5. ADB Port Forwarding and Reverse: Manage TCP socket forwarding via dioxamine.adb.forwardAdd() / reverseAdd().
  6. UI Controls, Dialogs, Buttons, Vibration and Fullscreen: Show native Material toasts, blocking dialogs, toggle edge-to-edge full-screen mode, intercept Back and Volume buttons, trigger native vibration and haptic feedback (vibrate, haptics), inspect host app version, and open external links in the host device browser.
  7. Native Logging and Debugging: Forward logs and console output directly to Android Logcat.
  8. Dynamic Theming and Material 3: Integrate with Dioxamine’s dynamic color schemes and listen for theme changes.
  9. App Language and Localization: Detect Dioxamine’s active app language, text direction (RTL/LTR), and build multi-language plugins.
  10. Network HTTP Client (http.fetch): Perform asynchronous HTTP/HTTPS network requests with native CORS-free execution and permission gating.
  11. Fastboot Protocol Operations: Inspect bootloader variables, execute raw commands, flash partitions, live boot images, switch slots, and reboot devices via dioxamine.fastboot.*.