Echo
Echo is a decentralized, off-grid peer-to-peer messaging application for Android. It operates directly device-to-device over Bluetooth Low Energy (BLE) without internet access, cellular networks, Wi-Fi infrastructure, or centralized servers.
Current Features
- Off-Grid BLE Transport: Communicates directly between Android devices using custom GATT server and client native modules.
- Real-Time Peer Discovery: Scans and lists nearby Echo nodes with signal strength (RSSI) indicators:
- Strong (>= -60 dBm)
- Good (>= -75 dBm)
- Fair (>= -90 dBm)
- Weak (< -90 dBm)
- Channels & Direct Messages:
- Default global broadcast room (
global_mesh_room). - Custom topic channels (such as
#generalor#rescue). - Direct 1-on-1 private messaging to discovered peer nodes.
- Default global broadcast room (
- Cryptographic Identities: On-device identity generation using Ed25519 and X25519 keypairs, persisted locally in secure hardware storage via Expo SecureStore.
- Packet Framing & Chunking: Custom binary wire protocol framing with automated chunking and reassembly to reliably transmit payloads across BLE MTU limits.
- Local Persistence: Encrypted local message and room history stored on-device using SQLite (
expo-sqlite). - Anti-Tracking Advertising Tags: Rotates advertising tags to prevent persistent physical hardware tracking.
System Requirements
- Target OS: Android 8.0 (API level 26) through Android 13+ (API level 33+)
- Hardware: Bluetooth 4.2+ with BLE Peripheral and Central support
- Development Environment:
- Node.js: v18.0.0 or higher
- Java Development Kit: OpenJDK 17
- Android SDK: Platform API 34 or 35, Build-Tools 35.0.0+
Environment Setup by Operating System
Linux (Ubuntu / Debian)
-
Update packages and install OpenJDK 17 and dependencies:
sudo apt update sudo apt install -y openjdk-17-jdk git curl unzip
-
Install Node.js (LTS):
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - sudo apt install -y nodejs -
Install Android Command Line Tools or Android Studio:
Download Android Studio from the official website or install the command line tools.
Export the environment variables in your~/.bashrcor~/.zshrc:export ANDROID_HOME=$HOME/Android/Sdk export PATH=$PATH:$ANDROID_HOME/emulator export PATH=$PATH:$ANDROID_HOME/platform-tools export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin
Apply changes:
source ~/.bashrc
Linux (Arch Linux)
-
Install JDK 17, Node.js, and Android platform tools:
sudo pacman -S jdk17-openjdk nodejs npm android-tools
-
Set default Java version:
sudo archlinux-java set java-17-openjdk -
Configure environment variables in
~/.bashrcor~/.zshrc:export ANDROID_HOME=$HOME/Android/Sdk export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/cmdline-tools/latest/bin
macOS
-
Install Homebrew if not already installed, then install OpenJDK 17 and Node.js:
brew install openjdk@17 node android-platform-tools
-
Symlink OpenJDK for the system Java wrapper:
sudo ln -sfn $(brew --prefix)/opt/openjdk@17/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-17.jdk -
Install Android Studio via Homebrew or manually:
brew install --cask android-studio
-
Configure environment variables in
~/.zshrc:export JAVA_HOME=$(/usr/libexec/java_home -v 17) export ANDROID_HOME=$HOME/Library/Android/sdk export PATH=$PATH:$ANDROID_HOME/emulator export PATH=$PATH:$ANDROID_HOME/platform-tools export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin
Apply changes:
source ~/.zshrc
Windows
-
Install OpenJDK 17, Node.js LTS, and Android Studio using Windows Package Manager (
wingetin PowerShell as Administrator):winget install Microsoft.OpenJDK.17 winget install OpenJS.NodeJS.LTS winget install Google.AndroidStudio -
Configure System Environment Variables:
- Set
JAVA_HOMEto your JDK directory (typicallyC:\Program Files\Microsoft\jdk-17...). - Set
ANDROID_HOMEtoC:\Users\<YourUsername>\AppData\Local\Android\Sdk. - Add the following paths to your system
Pathvariable:%ANDROID_HOME%\platform-tools%ANDROID_HOME%\cmdline-tools\latest\bin%JAVA_HOME%\bin
- Set
-
Open a new PowerShell terminal to verify:
java -version node -v adb --version
Build and Run Instructions
1. Clone and Install Dependencies
git clone https://github.com/damnbadcoder/Echo.git
cd Echo
npm install2. Run Automated Tests
Run the test suite to verify cryptographic operations, binary wire protocol framing, chunking pipelines, and dispatcher queues:
npx vitest run3. Start Development Server
To start Metro and the Expo development server:
npx expo startTo run directly on a connected Android device with development client:
npx expo run:androidFor frontend layout and styling inspection in a browser:
npx expo start --webA lightweight web fallback (store.web.ts) is provided solely for browser UI previewing. Full BLE mesh routing requires an Android device.
4. Build Standalone Android APK
Linux / macOS
cd android
./gradlew assembleRelease
cd ..Windows (PowerShell / Command Prompt)
cd android
.\gradlew.bat assembleRelease
cd ..The compiled release APK will be generated at:
android/app/build/outputs/apk/release/app-release.apk
To build a debug APK instead, replace assembleRelease with assembleDebug.
5. Install APK via ADB
Ensure your Android device is connected via USB and recognized:
adb devicesInstall the APK:
adb install -r android/app/build/outputs/apk/release/app-release.apkSideloading, Play Protect, and Developer Setup
1. Enabling Developer Mode and USB Debugging
To install the APK directly from your computer over USB, your phone must have Developer Mode and USB Debugging enabled:
- Open Settings on your Android device.
- Navigate to About Phone (or Software Information on Samsung devices).
- Tap Build Number repeatedly seven (7) times until a prompt announces "You are now a developer!".
- Go back to Settings -> System -> Developer Options (or Additional Settings on Xiaomi/MIUI).
- Toggle USB Debugging to ON.
- Connect the phone to your computer with a USB cable.
- When the prompt "Allow USB debugging?" appears on your device screen, check "Always allow from this computer" and tap Allow.
2. Resolving Google Play Protect Warnings
Because Echo is built locally or downloaded outside of the Google Play Store, it is signed with a local/custom certificate. Google Play Protect will flag sideloaded APKs with a security warning.
Common Play Protect Scenarios and Solutions:
- "Unrecognized App / Blocked by Play Protect" dialog during manual install:
- Tap More details (small text below the warning).
- Tap Install anyway (unsafe) to proceed with the installation.
- Installation completely blocked by OS:
- Open the Google Play Store app.
- Tap your profile icon in the top right corner.
- Tap Play Protect -> tap the Settings icon (gear in the top right).
- Temporarily toggle off Scan apps with Play Protect.
- Re-install the APK, then re-enable the setting if desired.
- ADB install blocked by Play Protect prompt:
- When running
adb install, check your device screen. Play Protect may show a prompt asking whether to allow the installation from an unknown source. Tap Install or Allow.
- When running
3. Permissions and OEM Background Restrictions
For Echo to function properly off-grid, the following device settings must be configured:
- Bluetooth and Nearby Devices Permissions:
- On Android 12 and 13+ (API 31+), Echo prompts for
BLUETOOTH_SCAN,BLUETOOTH_CONNECT, andBLUETOOTH_ADVERTISE. These must be set to "Allow".
- On Android 12 and 13+ (API 31+), Echo prompts for
- Location Services (GPS Toggle):
- On Android 8.0 through Android 11, the Android OS requires system Location Services (GPS) to be switched ON in the notification quick settings panel in order to discover BLE advertisements, even though Echo does not access or store geographical GPS coordinates.
- Battery Optimization and Background Killing:
- Aggressive battery managers on devices manufactured by Xiaomi (MIUI/HyperOS), Samsung (OneUI), Huawei, and OnePlus (OxygenOS) terminate background BLE GATT connections.
- Navigate to Settings -> Apps -> Echo -> Battery and select Unrestricted (or "Don't optimize") to maintain continuous mesh node listening.
Repository Structure
Echo/
├── android/ # Native Android project configuration and Gradle scripts
├── assets/ # App icons, splash graphics, and tab drawables
├── modules/
│ └── ble-mesh/ # Native Android BLE GATT server and central manager module
├── src/
│ ├── app/
│ │ ├── _layout.tsx # Root layout, theme setup, and permission gateway
│ │ ├── index.tsx # Node discovery, RSSI signal display, and channel navigation
│ │ └── chat.tsx # Real-time chat screen, message feed, and room controller
│ ├── components/
│ │ ├── RadioAccessGate.tsx # Runtime Bluetooth and Location permission controller
│ │ ├── animated-icon.tsx # Startup splash animation overlay
│ │ └── app-tabs.tsx # Bottom tab navigation bar
│ └── lib/
│ ├── MeshService.ts # BLE lifecycle manager, GATT routing, and packet scheduler
│ ├── protocol.ts # Binary wire protocol framing and serialization
│ ├── chunker.ts # MTU packet chunker and reassembly buffer
│ ├── crypto-core.ts # Ed25519, X25519, and XChaCha20-Poly1305 cryptographic engine
│ ├── store.ts # SQLite message history and SecureStore identity persistence
│ ├── store.web.ts # Web storage fallback for browser UI preview
│ ├── dispatcher.ts # Internal packet event dispatcher
│ └── tag-manager.ts # Anti-tracking rotating advertisement tag generator
├── package.json # Project dependencies and operational scripts
└── tsconfig.json # TypeScript compiler configuration
License
This project is licensed under the MIT License. See the LICENSE file for details.