CLI tool to expose Android devices remotely via NativeBridge
Project description
๐ BridgeLink
BridgeLink is a production-ready CLI tool that exposes your local Android devices remotely via the NativeBridge platform, making them accessible from anywhere with secure tunneling powered by bore.
โจ Features
- ๐ One-Command Setup - Install and configure in seconds
- ๐ฑ Multi-Device Support - Manage multiple Android devices simultaneously
- ๐ก WiFi Connection Support - Connect devices wirelessly via WiFi (no USB cable needed!)
- ๐ Secure Tunneling - API key-based authentication via NativeBridge
- ๐ Remote Access - Access devices from anywhere in the world
- ๐ค Auto-Installation - Automatically installs bore tunnel and ADB
- ๐ป Cross-Platform - Works on macOS, Linux, and Windows
- ๐ Background Management - Tunnels run in the background as daemons
- ๐ Automatic Health Monitoring - Auto-detects and deactivates disconnected devices (1s polling - fast!)
- ๐ Auto-Activation - Devices automatically reconnect when plugged back in (1s polling - fast!)
- ๐ Device Tracking - Track device state and connection URLs in real-time
- โ Input Validation - Validates device serials via ADB before backend calls
- ๐ฏ Smart Activation - Intelligently reactivates existing devices
- ๐ก๏ธ Platform-Aware Detection - Different health checks for physical devices vs emulators
- ๐ USB & WiFi Support - Seamlessly handles both USB and wireless connections
๐ฆ Installation
Choose your preferred installation method:
Option 1: Homebrew (macOS) - Recommended for Mac users
# Add the BridgeLink tap
brew tap AutoFlowLabs/tap
# Install BridgeLink
brew install bridgelink
# Run setup to install required tools (ADB, bore)
bridgelink setup
Option 2: pip (Linux, Windows, macOS)
Method A: Virtual Environment (Recommended)
macOS / Linux
# Create virtual environment
python3 -m venv bridgelink-env
# Activate virtual environment
source bridgelink-env/bin/activate
# Install BridgeLink
pip install bridgelink
# Run setup
bridgelink setup
Windows (Command Prompt)
# Create virtual environment
python -m venv bridgelink-env
# Activate virtual environment
bridgelink-env\Scripts\activate.bat
# Install BridgeLink
pip install bridgelink
# Run setup
bridgelink setup
Windows (PowerShell)
# Create virtual environment
python -m venv bridgelink-env
# Activate virtual environment
bridgelink-env\Scripts\Activate.ps1
# If you get an execution policy error, run:
# Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# Install BridgeLink
pip install bridgelink
# Run setup
bridgelink setup
Note: Remember to activate the virtual environment each time you open a new terminal session before using BridgeLink.
Method B: Global Installation
If you prefer to install globally (not recommended due to potential dependency conflicts):
# Linux/macOS
pip install bridgelink
# Or with sudo if permission denied:
sudo pip install bridgelink
# Windows (run terminal as Administrator)
pip install bridgelink
After installation, run setup:
bridgelink setup
This automatically installs required tools:
- bore - Tunnel binary for your platform (macOS, Linux, Windows)
- ADB - Android Debug Bridge from Google
๐ Quick Start
After installation, follow these steps:
1. Set API Key
Get your API key from NativeBridge Dashboard:
macOS / Linux:
export NB_API_KEY='Nb-kNGB.your-api-key-here'
Windows (Command Prompt):
set NB_API_KEY=Nb-kNGB.your-api-key-here
Windows (PowerShell):
$env:NB_API_KEY="Nb-kNGB.your-api-key-here"
2. Connect Your Device
Option A: USB Connection (Default) Connect your Android device via USB and enable USB debugging.
Option B: WiFi Connection (Wireless)
- Connect your Android device via USB first
- Ensure both device and computer are on the same WiFi network
- Use the
--wififlag when adding the device (see below)
3. Add Device
USB Connection:
bridgelink devices add <device-serial>
WiFi Connection:
bridgelink devices add <device-serial> --wifi
After WiFi setup completes, you can disconnect the USB cable. The device will remain accessible via WiFi!
4. Access Remotely
Option A: Via ADB Command Line
adb connect bridgelink.nativebridge.io:15750
Option B: Via NativeBridge Dashboard Visit the BridgeLink Dashboard to:
- ๐ View all your registered devices
- ๐ฎ Start remote device sessions
- ๐ฅ๏ธ Control devices directly from your browser
- ๐ Monitor device status in real-time
Dashboard URL: https://nativebridge.io/dashboard/bridgelink (Development: https://trust-me-bro.nativebridge.io/dashboard/bridgelink)
๐ Commands
Device Management
# Add device(s)
bridgelink devices add <serial> # USB connection
bridgelink devices add <serial> --wifi # WiFi connection (USB required initially)
bridgelink devices add <serial1> <serial2> # Multiple devices
bridgelink devices add <serial> --auto-activate # Enable auto-activation
bridgelink devices add <serial> --wifi --auto-activate # WiFi + auto-activation
# Activate existing device
bridgelink devices activate <serial> # Works with both USB and WiFi devices
# List all devices
bridgelink devices list
# Deactivate device (keeps registration)
bridgelink devices deactivate <serial>
bridgelink devices deactivate # Deactivate ALL active devices (with confirmation)
bridgelink devices deactivate --all # Deactivate ALL active devices
# Remove device completely
bridgelink devices remove <serial>
# Auto-activation management
bridgelink devices set-auto-activate <serial> on # Enable auto-activation
bridgelink devices set-auto-activate <serial> off # Disable auto-activation
Daemon Management
# Check tunnel status
bridgelink daemon status
# View tunnel logs
bridgelink daemon logs <serial>
# Stop tunnel(s)
bridgelink daemon stop <serial> # Stop specific tunnel
bridgelink daemon stop # Stop ALL tunnels (with confirmation)
bridgelink daemon stop --all # Stop ALL tunnels
# Clean up dead tunnels
bridgelink daemon cleanup
Setup & Installation
# Run interactive setup (installs bore, ADB, configures API key)
bridgelink setup
# Install both bore and ADB (non-interactive)
bridgelink install
# Install only bore
bridgelink install --bore-only
# Install only ADB
bridgelink install --adb-only
๐ก WiFi Connection (Wireless ADB)
BridgeLink supports wireless ADB connections via WiFi, allowing you to use your devices without USB cables!
How It Works
-
Initial Setup (USB Required):
- Connect device via USB
- Run:
bridgelink devices add <serial> --wifi - BridgeLink will:
- Enable TCP/IP mode on the device (port 5555)
- Get the device's WiFi IP address
- Connect via WiFi (
adb connect <ip>:5555) - Create tunnel using WiFi connection
-
After Setup:
- Disconnect the USB cable
- Device remains connected via WiFi
- Tunnel continues working wirelessly
- Access remotely via BridgeLink URL
Requirements
- Device and computer must be on the same WiFi network
- WiFi must be enabled on the Android device
- USB connection required only for initial setup
Example Usage
# Initial setup (USB connected)
bridgelink devices add 1d752b81 --wifi
# Output:
# ๐ก Setting up WiFi connection...
# Step 1/3: Enabling TCP/IP mode on device...
# โ TCP/IP mode enabled on port 5555
# Step 2/3: Getting device IP address...
# โ Device IP address: 192.168.1.15
# Step 3/3: Connecting to device via WiFi...
# โ Connected via WiFi: 192.168.1.15:5555
#
# ๐ก You can now disconnect the USB cable!
# Now disconnect USB - device stays connected via WiFi!
# Tunnel URL: bridgelink.nativebridge.io:15750
Multiple WiFi Devices
You can connect multiple devices via WiFi simultaneously:
# Add first device via WiFi
bridgelink devices add device1_serial --wifi
# Add second device via WiFi
bridgelink devices add device2_serial --wifi
# List all devices
bridgelink devices list
# Shows both devices with WiFi connections (IP:5555 format)
WiFi + Auto-Activation
Combine WiFi with auto-activation for ultimate convenience:
bridgelink devices add <serial> --wifi --auto-activate
Now your device will:
- โ Connect wirelessly via WiFi
- โ Auto-deactivate when disconnected from WiFi
- โ Auto-activate when reconnected to WiFi
- โ No USB cable needed after initial setup
Limitations & Notes
- Reboot: If you restart the device, it will reset to USB mode. You'll need to run the WiFi setup again (USB cable +
--wififlag). - Network: Device and computer must remain on the same WiFi network
- Battery: WiFi ADB consumes more battery than USB ADB
- Performance: WiFi connection may have slightly higher latency than USB
Troubleshooting WiFi
Device not connecting?
# Check device IP manually
adb shell ip route | grep src
# Try manual connection
adb connect <device-ip>:5555
# Verify connection
adb devices
Connection lost?
- Ensure device hasn't gone to sleep (keep screen on during setup)
- Check both devices are on same WiFi network
- Try reconnecting:
adb connect <ip>:5555
๐ Automatic Health Monitoring & Auto-Activation
BridgeLink includes two automatic background monitors that work together to provide a fully automated device lifecycle:
1. Health Monitor (Auto-Deactivation)
Watches for disconnections and automatically deactivates devices
- Auto-Start: When you add the first device, a background daemon automatically starts
- Continuous Monitoring: Checks device connectivity every 1 second (fast!)
- Smart Detection:
- Physical Devices: Must be in "device" state (strict)
- Emulators: Can be in "device" or "offline" state (lenient)
- Auto-Cleanup: When devices disconnect, automatically:
- Stops the tunnel
- Updates backend state to "inactive"
- No stale connections!
- Auto-Stop: When all devices are deactivated, the daemon automatically stops
2. Connection Monitor (Auto-Activation) ๐
Watches for reconnections and automatically activates devices with auto-activation enabled
- Auto-Start: When you enable auto-activation for a device, the connection monitor starts
- Continuous Watching: Checks for newly connected devices every 1 second (fast!)
- Smart Activation: When a device reconnects:
- Checks if device has
auto_activateenabled in backend - Verifies device is currently inactive
- Automatically creates tunnel and activates device
- Checks if device has
- Zero Manual Intervention: Once enabled, devices reconnect automatically when plugged back in
What This Means for You
โ No Manual Monitoring - Everything happens automatically โ Lightning Fast Detection - Disconnects/reconnects detected within 1 second! โ Clean State - No stale tunnels or active states โ Zero Maintenance - Daemons manage themselves โ Opt-in Auto-Reconnect - Enable per device as needed
Example Flow (With Auto-Activation)
# 1. Add a device with auto-activation enabled
$ bridgelink devices add emulator-5554 --auto-activate
๐ Starting background health monitor...
โ
Health monitor started
๐ Starting auto-activation connection monitor...
โ
Connection monitor started
๐ก Health monitoring is active - disconnected devices will be auto-deactivated
๐ Auto-activation ENABLED - device will auto-reconnect when plugged back in
# 2. Device gets physically disconnected
# (Health monitor automatically detects and deactivates)
# Logs to ~/.bridgelink/monitor.log:
# โ ๏ธ Device emulator-5554 is unhealthy: Device disconnected
# Stopping tunnel...
# Updating backend state to inactive...
# โ
Device emulator-5554 deactivated successfully
# 3. Device gets reconnected (USB plugged back in)
# (Connection monitor automatically detects and activates)
# Logs to ~/.bridgelink/connection_monitor.log:
# ๐ Detected 1 newly connected device(s)
# ๐ Auto-activating device: emulator-5554
# Setting up ADB TCP mode...
# Creating bore tunnel...
# Tunnel URL: bridgelink.nativebridge.io:15751
# โ
Device emulator-5554 auto-activated successfully
#
# โ No manual intervention needed!
Daemon Locations
Health Monitor:
- PID File:
~/.bridgelink/monitor.pid - Log File:
~/.bridgelink/monitor.log - State File:
~/.bridgelink/health_monitor.json
Connection Monitor:
- PID File:
~/.bridgelink/connection_monitor.pid - Log File:
~/.bridgelink/connection_monitor.log
๐ Documentation
For complete documentation, visit the GitHub repository.
Key Guides:
- Security Guide - Security best practices โ ๏ธ READ FIRST
- Auto-Activation Feature - Detailed auto-activation guide ๐
- Complete Command Reference - All commands with examples
- Architecture - System architecture and data flow
- Deployment Guide - Backend setup and deployment
- Local Testing - Test before PyPI release
- PyPI Release - Publishing guide
๐ NativeBridge Dashboard
After registering a device with BridgeLink, you can manage it through the NativeBridge Dashboard.
Dashboard Features
Device Management:
- ๐ View all your BridgeLink devices in one place
- โ See device status (active/inactive)
- ๐ View tunnel URLs for each device
- ๐ฑ Check comprehensive device details:
- Hardware: Model, manufacturer, CPU, RAM, storage
- Display: Resolution, density (DPI)
- Software: Android version, SDK, security patch
- Connection: Tunnel URL, device type (USB/WiFi)
Remote Sessions:
- ๐ฎ Start remote device sessions directly from the browser
- ๐ฅ๏ธ Control devices remotely without ADB command line
- ๐ฑ๏ธ Click, swipe, and interact with your device
- ๐ธ Take screenshots and record sessions
- ๐ Real-time device mirroring
Monitoring:
- ๐ Monitor device connection status
- โฑ๏ธ View device uptime and availability
- ๐ Track device usage and sessions
Accessing the Dashboard
Production:
https://nativebridge.io/dashboard/bridgelink
Development:
https://trust-me-bro.nativebridge.io/dashboard/bridgelink
Note: The dashboard URL is automatically shown when you add or activate a device. Look for the ๐ icon in the CLI output!
How It Works
-
Register Device:
bridgelink devices add <device-serial>
-
Device Appears in Dashboard:
- Automatically registered in your NativeBridge account
- Visible at the dashboard URL
-
Start Remote Session:
- Click on your device in the dashboard
- Click "Start Session"
- Control device from your browser!
Use Cases
Web-Based Testing:
- Test your app without installing ADB
- Share device access with team members
- Demo apps remotely in meetings
Remote Debugging:
- Debug issues on physical devices from anywhere
- No need for VPN or complex network setup
- Instant access through secure tunnel
Device Management:
- Centralized view of all your test devices
- Quick access to device information
- Easy activation/deactivation
๐ง Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
NB_API_KEY |
NativeBridge API key | Required |
NB_API_URL |
Backend API URL | https://dev.api.nativebridge.io |
BORE_SERVER |
Bore tunnel server | bridgelink.nativebridge.io |
State Directory
BridgeLink stores configuration in ~/.bridgelink/:
tunnels.json- Tunnel statetunnel_<serial>.log- Individual tunnel logs
๐ก๏ธ Security
- โ ADB Validation - Device serials validated before backend calls
- โ API Key Auth - Secure authentication for all operations
- โ User Isolation - Each user only sees their own devices
- โ HTTPS - Encrypted communication with backend
๐ค Support
- Email: support@nativebridge.io
- Issues: https://github.com/AutoFlowLabs/bridgelink/issues
- Docs: https://docs.nativebridge.io/bridgelink
- API Key: https://nativebridge.io/dashboard/api-keys
๐ Acknowledgments
- bore - Fast, simple TCP tunnel
- ADB - Android Debug Bridge by Google
- Click - Python CLI framework
- FastAPI - Modern Python web framework
๐ License
MIT License - see LICENSE file for details.
Made with โค๏ธ by the NativeBridge team
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bridgelink-0.3.0.tar.gz.
File metadata
- Download URL: bridgelink-0.3.0.tar.gz
- Upload date:
- Size: 45.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28e82e2a8b5a5793f713c1c7b57360dac62426d7be7d00b3a47fa8c60bb2a66e
|
|
| MD5 |
a6a92ce9881c64e6631008e99eef9bcd
|
|
| BLAKE2b-256 |
13e51120d3112410c0829e3045aad2176418bd3437fb3d7c49aa0c4f60d59188
|
Provenance
The following attestation bundles were made for bridgelink-0.3.0.tar.gz:
Publisher:
release.yml on AutoFlowLabs/bridgelink
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bridgelink-0.3.0.tar.gz -
Subject digest:
28e82e2a8b5a5793f713c1c7b57360dac62426d7be7d00b3a47fa8c60bb2a66e - Sigstore transparency entry: 728645593
- Sigstore integration time:
-
Permalink:
AutoFlowLabs/bridgelink@06d82fda5533bdd40fd1f012dd7fe1fa08d5a117 -
Branch / Tag:
refs/heads/production - Owner: https://github.com/AutoFlowLabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@06d82fda5533bdd40fd1f012dd7fe1fa08d5a117 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bridgelink-0.3.0-py3-none-any.whl.
File metadata
- Download URL: bridgelink-0.3.0-py3-none-any.whl
- Upload date:
- Size: 50.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51a4b4cddb445259564c166b135fe984029c349ea7dbff2adaa969278cc53142
|
|
| MD5 |
296161ad48a9d2fc1bfbf039b3f5e8e8
|
|
| BLAKE2b-256 |
04c9a37d5dd8500f17976244e02e0865f7c5cf4340439e1e9c9eaf7f8e79435c
|
Provenance
The following attestation bundles were made for bridgelink-0.3.0-py3-none-any.whl:
Publisher:
release.yml on AutoFlowLabs/bridgelink
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bridgelink-0.3.0-py3-none-any.whl -
Subject digest:
51a4b4cddb445259564c166b135fe984029c349ea7dbff2adaa969278cc53142 - Sigstore transparency entry: 728645596
- Sigstore integration time:
-
Permalink:
AutoFlowLabs/bridgelink@06d82fda5533bdd40fd1f012dd7fe1fa08d5a117 -
Branch / Tag:
refs/heads/production - Owner: https://github.com/AutoFlowLabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@06d82fda5533bdd40fd1f012dd7fe1fa08d5a117 -
Trigger Event:
push
-
Statement type: