init
This commit is contained in:
65 files changed
+5782
No files matched your search
@@ -0,0 +1,72 @@
|
||||
# Android SMS Gateway
|
||||
|
||||
Android SMS Gateway turns a dedicated Android phone into a directly reachable, HTTP-based SMS gateway. A trusted backend can check device health, send SMS messages, and retrieve locally persisted incoming and outgoing history without polling, FCM, WebSockets, or a cloud relay.
|
||||
|
||||
## Current MVP
|
||||
|
||||
- Embedded NanoHTTPD server with configurable port and bind address
|
||||
- Offline interactive Swagger UI at `GET /docs`, backed by the packaged OpenAPI contract
|
||||
- Versioned `/api/v1` REST API
|
||||
- API-key authentication and exact-IP allowlist
|
||||
- Android `SmsManager` submission with asynchronous sent/failure result tracking
|
||||
- Safe incoming SMS broadcast handling
|
||||
- Room persistence for messages, settings, and sanitized request logs
|
||||
- Foreground-service lifecycle, optional reboot startup, status, uptime, and counters
|
||||
- Compose Material 3 dashboard, history, logs, server, security, and permissions screens
|
||||
- OpenAPI contract and an agent-ready `SKILL.md`
|
||||
|
||||
Multipart SMS, delivery reports, retries, queues, CIDR allowlists, HMAC signing, multiple SIM selection, TLS termination, and cloud management are intentionally outside this MVP.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Android Studio with JDK 17 or newer
|
||||
- Android SDK 37
|
||||
- Android 8.0 (API 26) or newer phone with telephony/SMS support
|
||||
- A backend that can directly route to the phone over a trusted LAN, VPN, public/static IP, or carefully configured port forwarding
|
||||
|
||||
## Build
|
||||
|
||||
```bash
|
||||
./gradlew assembleDebug
|
||||
./gradlew testDebugUnitTest
|
||||
./gradlew lintDebug
|
||||
```
|
||||
|
||||
The debug APK is written to `app/build/outputs/apk/debug/app-debug.apk`.
|
||||
|
||||
## First run
|
||||
|
||||
1. Install and open the app on an SMS-capable phone.
|
||||
2. Open **Server → SMS Permissions** and grant Send SMS and Receive SMS. Grant notifications so the foreground server status remains visible.
|
||||
3. Open **Security**, enter a private API key of at least 16 characters, and keep authentication enabled.
|
||||
4. Optionally enable the exact-IP allowlist and add the backend's source IP.
|
||||
5. Open **Server**, confirm the port and bind address, then save.
|
||||
6. Return to **Dashboard** and start the server.
|
||||
7. Call `GET /api/v1/health` with `Authorization: Bearer <key>`.
|
||||
|
||||
API keys are stored only as SHA-256 hashes. They cannot be recovered from the app, so keep the original key in the backend's secret store.
|
||||
|
||||
## Network configuration
|
||||
|
||||
The default endpoint is `0.0.0.0:8080`, which listens on all IPv4 interfaces. The dashboard shows a currently detected non-loopback IPv4 address. The port is validated in the range 1024–65535.
|
||||
|
||||
The MVP serves plaintext HTTP. HTTP does not encrypt messages or credentials and must only be used on a trusted network. For remote connections, place the phone behind a VPN or a TLS-capable reverse proxy and firewall the port. Do not expose an unauthenticated gateway to the public internet.
|
||||
|
||||
## Android behavior
|
||||
|
||||
- The HTTP server runs in a foreground service with a persistent notification.
|
||||
- If Android stops the process, OS/device battery policies can affect recovery. Exempt the app from aggressive vendor battery optimization on dedicated gateway devices.
|
||||
- Reboot startup works only when enabled in Server settings and when the server was enabled before reboot.
|
||||
- Sent status means Android's SMS service accepted the submission; carrier delivery reports are not implemented yet.
|
||||
- The MVP limits outgoing message bodies to 160 characters. Multipart SMS is planned separately.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **503 AUTHENTICATION_NOT_CONFIGURED:** set an API key in Security settings.
|
||||
- **401 INVALID_API_KEY:** verify the backend secret and Bearer header.
|
||||
- **403 IP_NOT_ALLOWED:** add the actual backend source IP or disable the allowlist temporarily.
|
||||
- **SMS_PERMISSION_DENIED:** grant Send SMS from the Permissions screen.
|
||||
- **Server start error:** choose an unused port and ensure the bind address exists on the device.
|
||||
- **Backend cannot connect:** confirm both devices can route to each other and that Wi-Fi isolation/firewall rules permit the configured TCP port.
|
||||
|
||||
See [API.md](API.md), [SKILL.md](SKILL.md), [ARCHITECTURE.md](ARCHITECTURE.md), [SECURITY.md](SECURITY.md), and [openapi.yaml](openapi.yaml).
|
||||
Reference in new issue
Block a user