# Device Trigger — Android Remote Device Control App
A clean, native Android mobile application designed to remotely control the power states of multiple machines (e.g. servers, Debian/Pop!_OS nodes, lab rigs).
The app features a **horizontal swipe interface** where each device is represented by a dedicated screen with **three massive, high-contrast, tactile buttons**:
1. 🟢 **POWER ON** — Sends remote power on / wake trigger
3. 🔴 **POWER OFF** — Shuts down the machine (confirmation protected)
Endpoints for each machine are loaded dynamically by fetching a lightweight JSON configuration hosted in a **Cloudflare R2** bucket. Critical actions (`poweroff` and `reboot`) authenticate using a device-specific `secretKey`.
---
## 📱 Pre-built Ready-to-Install APK
The application has been compiled into a ready-to-install debug APK:
*Or transfer `app-debug.apk` directly to your phone and tap to install.*
---
## 🚀 Key Features
- **Massive Tactile Buttons**: High-contrast, large touch targets designed to prevent accidental mis-taps while remaining effortless to press.
- **Horizontal Swipe Navigation**: Seamlessly swipe left and right between configured machines with an animated bottom page indicator.
- **Dynamic Cloudflare R2 Configuration**: Simply supply your Cloudflare R2 JSON URL when adding a device; the app fetches and validates endpoint URLs automatically.
- **One-Tap R2 Config Re-fetch**: If you modify endpoint URLs in your Cloudflare R2 JSON, simply tap the **Re-fetch R2 JSON** button (or top-bar Sync) to update all URLs instantly without losing your device secretKey or configuration.
- **Device Configuration Editor**: Easily edit device names, node identifiers, secret keys, or R2 URLs anytime via the built-in edit dialog.
- **In-App Self-Updating (OTA)**: Automatically checks GitHub Releases on launch. When a newer version is pushed to GitHub, an in-app dialog displays the changelog with a one-tap "Update Now" installer that updates the APK in-place without wiping any saved data or credentials.
- **Persistent Local Storage**: Configured machines are safely saved to Android persistent storage (`SharedPreferences`) so they remain available whenever the app is reopened and preserved across app updates.
- **Mistake-Proof Safety Prompts**: Reboot, Power Off, and Power On actions trigger a quick confirmation dialog before sending the request.
- **Instant Visual Feedback**: On-screen status banners, in-button loading indicators, live uptime/last-seen telemetry, and Android Toast notifications display HTTP status codes (e.g., `200 OK`) and server responses.
*Note: The built-in parser is resilient and automatically accepts key variants such as `power_on`, `powerOn`, `power_off`, `powerOff`, `restart`, and `shutdown`.*
---
## 📡 API Request Specification
When an action is triggered, the app dispatches an asynchronous HTTP `POST` request using `OkHttp`: