| # Android background capture (Scenario 2) |
|
|
| Unlike iOS, Android **allows background message capture**, so you get real on-phone autonomy β just |
| not for iMessage. A no-build recipe (Tasker or MacroDroid) calls the same shared **`POST /agent`** |
| backend the Mac collector and iOS Shortcut use. |
|
|
| ## What you need |
| - The backend reachable from the phone: the HF Space's dedicated-GPU path, a Mac/cloud box, or even |
| the phone itself (Termux). The free **ZeroGPU Space does not serve `/agent`** (Gradio-SDK only) β use |
| one of the others. |
| - The same `INGEST_TOKEN` the backend uses. |
|
|
| ## Tasker recipe (Notification Access β works for RCS/WhatsApp/SMS notifications) |
| 1. **Profile β Event β UI β Notification** (or **Phone β Received Text** for SMS). Restrict it to |
| your messaging app(s). |
| 2. **Task β Net β HTTP Request:** |
| - Method: `POST` |
| - URL: `https://<your-backend>/agent` |
| - Headers: `Authorization: Bearer <INGEST_TOKEN>` and `Content-Type: application/json` |
| - Body: |
| ```json |
| { "thread": "%evtprm()", "now": "%TIMES", "push_gcal": true } |
| ``` |
| (Use the notification text variable your trigger provides for `thread`; `%TIMES` β current time.) |
| 3. **Parse the response** (`Variable β JSON Read` on `plan.events`) if you want a confirmation |
| toast/notification; otherwise `push_gcal:true` already created the events in Google Calendar. |
| |
| MacroDroid is equivalent: **Trigger:** Notification Received / SMS Received β **Action:** HTTP POST |
| with the same URL/headers/body. |
|
|
| ## Notes |
| - This is genuinely hands-off: the OS delivers the trigger in the background. |
| - For a fully on-device variant, run the backend + a small model in **Termux** and point Tasker at |
| `http://127.0.0.1:7860/agent`, with `INFERENCE_BASE_URL` β a local `llama-server` (Gemma E4B / a |
| small Hermes). See [on-device.md](./on-device.md) and [hermes.md](./hermes.md). |
| - A native Kotlin `NotificationListenerService` app could replace Tasker for a polished install β a |
| separate effort; the Tasker recipe is the MVP. |
|
|