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
- ๐ 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
๐ Quick Start
1. Install BridgeLink
pip install bridgelink
2. Install Dependencies
bridgelink install
This automatically installs:
- bore - Tunnel binary for your platform (macOS, Linux, Windows)
- ADB - Android Debug Bridge from Google
3. Set API Key
Get your API key from NativeBridge Dashboard:
export NB_API_KEY='Nb-kNGB.your-api-key-here'
4. Connect Your Device
Connect your Android device via USB and enable USB debugging.
5. Add Device
bridgelink devices add <device-serial>
6. Access Remotely
adb connect bridgelink.nativebridge.io:15750
๐ Commands
Device Management
# Add device(s)
bridgelink devices add <serial>
bridgelink devices add <serial1> <serial2> # Multiple devices
bridgelink devices add <serial> --auto-activate # Enable auto-activation
# Activate existing device
bridgelink devices activate <serial>
# 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
Installation
# Install both bore and ADB
bridgelink install
# Install only bore
bridgelink install --bore-only
# Install only ADB
bridgelink install --adb-only
๐ 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
๐ง 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.2.0.tar.gz.
File metadata
- Download URL: bridgelink-0.2.0.tar.gz
- Upload date:
- Size: 36.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8154cf8f68ce5660d02e38d24b5d5ef1bce65ee2f900bf5cbdd44af73cf2a3d4
|
|
| MD5 |
a24ca99b21d9b13859a06086819b9ff2
|
|
| BLAKE2b-256 |
47b00e080d1f7ad238cf68f1c373888537402cac14448b0e44395f7dd9515b00
|
Provenance
The following attestation bundles were made for bridgelink-0.2.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.2.0.tar.gz -
Subject digest:
8154cf8f68ce5660d02e38d24b5d5ef1bce65ee2f900bf5cbdd44af73cf2a3d4 - Sigstore transparency entry: 712279138
- Sigstore integration time:
-
Permalink:
AutoFlowLabs/bridgelink@3745c1290b23968ac4a014150c78c7d588e9c67b -
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@3745c1290b23968ac4a014150c78c7d588e9c67b -
Trigger Event:
push
-
Statement type:
File details
Details for the file bridgelink-0.2.0-py3-none-any.whl.
File metadata
- Download URL: bridgelink-0.2.0-py3-none-any.whl
- Upload date:
- Size: 44.1 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 |
4cc3422c9e9a19881bc9d07ac1e54f4a8cf7691b42f382c7393831ff7ca5171c
|
|
| MD5 |
573b9084c8c6f83578278b9a3580d312
|
|
| BLAKE2b-256 |
bba20cb8fa218ca7f860d9a433b1f3eb56a8f52c87073ed75db10829be8078e9
|
Provenance
The following attestation bundles were made for bridgelink-0.2.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.2.0-py3-none-any.whl -
Subject digest:
4cc3422c9e9a19881bc9d07ac1e54f4a8cf7691b42f382c7393831ff7ca5171c - Sigstore transparency entry: 712279148
- Sigstore integration time:
-
Permalink:
AutoFlowLabs/bridgelink@3745c1290b23968ac4a014150c78c7d588e9c67b -
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@3745c1290b23968ac4a014150c78c7d588e9c67b -
Trigger Event:
push
-
Statement type: