Nudge is a Material 3 Expressive Kotlin Android app (inspired by nsh07/Tomato and sameerasw/essentials) and companion Linux Rust daemon (nudge-daemon) that automatically enables your phone's Wi-Fi Hotspot over Bluetooth when your computer loses internet connectivity, configures and connects NetworkManager to the hotspot, and shuts the hotspot off when primary internet returns.
- Material 3 Expressive UI: Built with Jetpack Compose (
MaterialExpressiveTheme,MotionScheme.expressive()), dynamic Material You colors, optional AMOLED Pitch-Black surface mode, and segmentedRoundedCardContainergroups (24.dpouter corners,4.dpinner stack corners). - Shizuku System Integration (No Root Required):
- Starts and stops Wi-Fi Tethering via
android.net.ITetheringConnector(ShizukuBinderWrapper), sharing mobile data or Wi-Fi just like the system Settings toggle. - Automatically reads your live SoftAP SSID, passphrase, and security type via
android.net.wifi.IWifiManager#getSoftApConfiguration().
- Starts and stops Wi-Fi Tethering via
- Zero Idle Battery Drain:
- Uses a hardware-backed Bluetooth Classic RFCOMM listening socket (
listenUsingRfcommWithServiceRecord) with 0% idle CPU and zero persistent WakeLocks. - Acquires a short-lived micro-WakeLock (max 10s) only when an incoming Bluetooth connection interrupt wakes the socket.
- Uses a hardware-backed Bluetooth Classic RFCOMM listening socket (
- Cryptographic Multi-Computer Security:
- Each enrolled computer has an individual 256-bit secret key (
HMAC-SHA256), replay-protected challenge-response handshake, and keystream-encrypted Wi-Fi passphrase transfer. - Reference-counted multi-computer leases: the hotspot stays active as long as any enrolled computer holds a lease, and automatically turns off when the last computer releases its lease (or after an idle client timeout).
- Each enrolled computer has an individual 256-bit secret key (
Run install.sh on any new Linux computer:
./install.shWhat install.sh does:
- Builds and installs
nudge-daemonto~/.local/bin/nudge-daemon. - Unblocks and powers on your local Bluetooth controller and detects your computer's hostname and Bluetooth MAC.
- Automatic ADB Mode (if your phone is plugged in via USB):
- Builds and installs the Android APK if not yet installed (
--install-apkforces a fresh APK build/install). - Starts the Shizuku server on your phone if it isn't running yet.
- Automatically enrolls your computer in the Nudge app, reads the generated 256-bit HMAC secret & phone Bluetooth MAC, pairs/trusts the phone in BlueZ, and saves
~/.config/nudge/config.toml(chmod 600). - Run completely unattended with
./install.sh --auto.
- Builds and installs the Android APK if not yet installed (
- Wireless / Interactive Mode (
./install.sh --wirelessor when no phone is connected over USB):- Prompts you to paste the
nudge-daemon pair ...command copied from the Nudge app (Enroll New Computer → Copy Linux CLI Command) or scan for nearby Bluetooth devices and enter the credentials interactively.
- Prompts you to paste the
- Verifies the live Bluetooth RFCOMM challenge-response (
nudge-daemon status) and installs/starts thesystemduser service (~/.config/systemd/user/nudge-daemon.service).
cd android
./gradlew assembleDebug
adb install -r app/build/outputs/apk/debug/app-debug.apkcd linux-daemon
cargo build --release- Pair your Linux computer and Android phone over Bluetooth (
bluetoothctl). - In the Nudge Android app, tap Enroll New Computer and copy the generated command:
nudge-daemon pair --phone-mac "AA:BB:CC:DD:EE:FF" --id "<UUID>" --secret "<64-HEX>" --name "MyLaptop"
- Test triggering and releasing the hotspot:
nudge-daemon trigger nudge-daemon status nudge-daemon release
- Run the automatic failover daemon:
nudge-daemon run --interval-secs 5