Android 应用(节点)
注意: Android 应用尚未公开发布。源代码可在 OpenClaw 代码库 中的apps/android下获取。您可以使用 Java 17 和 Android SDK (./gradlew :app:assemblePlayDebug) 自行构建。有关构建说明,请参阅 apps/android/README.md。
支持快照
- 角色:伴随节点应用 (Android 不托管 Gateway(网关))。
- 需要 Gateway(网关):是 (在 macOS、Linux 上运行,或通过 Windows 运行)。
- 安装:入门指南 + 配对。
- Gateway(网关):运行手册 + 配置。
- 协议:Gateway(网关) 协议(节点 + 控制平面)。
系统控制
系统控制 (launchd/systemd) 位于 Gateway(网关) 主机上。请参阅 Gateway(网关)。连接运行手册
Android 节点应用 ⇄ (mDNS/NSD + WebSocket) ⇄ Gateway(网关) Android 直接连接到 Gateway(网关) WebSocket (默认ws://<host>:18789) 并使用设备配对 (role: node)。
先决条件
- 您可以在“主机”机器上运行 Gateway(网关)。
- Android 设备/模拟器可以访问网关 WebSocket:
- 使用 mDNS/NSD 的同一局域网,或
- 使用广域 Tailscale / 单播 DNS-SD 的同一 Bonjour Tailnet (见下文),或
- 手动网关主机/端口 (回退选项)
- 您可以在网关机器上 (或通过 SSH) 运行 CLI (
openclaw)。
1) 启动 Gateway(网关)
listening on ws://0.0.0.0:18789
- 在网关主机的
~/.openclaw/openclaw.json中设置gateway.bind: "tailnet"。 - 重启 Gateway(网关) / macOS 菜单栏应用。
2) 验证发现 (可选)
从网关机器:Tailnet (Vienna ⇄ London) discovery via unicast DNS-SD
Android NSD/mDNS discovery won’t cross networks. If your Android node and the gateway are on different networks but connected via Tailscale, use Wide-Area Bonjour / unicast DNS-SD instead:- Set up a DNS-SD zone (example
openclaw.internal.) on the gateway host and publish_openclaw-gw._tcprecords. - Configure Tailscale split DNS for your chosen domain pointing at that DNS server.
3) Connect from Android
In the Android app:- The app keeps its gateway connection alive via a foreground service (persistent notification).
- Open the Connect tab.
- Use Setup Code or Manual mode.
- If discovery is blocked, use manual host/port (and TLS/token/password when required) in Advanced controls.
- Manual endpoint (if enabled), otherwise
- The last discovered gateway (best-effort).
4) Approve pairing (CLI)
On the gateway machine:5) Verify the node is connected
-
Via nodes status:
-
Via Gateway(网关):
6) Chat + history
The Android Chat tab supports 会话 selection (defaultmain, plus other existing sessions):
- History:
chat.history - Send:
chat.send - Push updates (best-effort):
chat.subscribe→event:"chat"
7) Canvas + camera
Gateway(网关) Canvas Host (recommended for web content)
If you want the node to show real HTML/CSS/JS that the agent can edit on disk, point the node at the Gateway(网关) canvas host. Note: nodes load canvas from the Gateway(网关) HTTP server (same port asgateway.port, default 18789).
-
Create
~/.openclaw/workspace/canvas/index.htmlon the gateway host. - Navigate the node to it (LAN):
.local,例如 http://<gateway-magicdns>:18789/__openclaw__/canvas/。
此服务器将实时重载客户端注入到 HTML 中,并在文件更改时重新加载。
A2UI 主机位于 http://<gateway-host>:18789/__openclaw__/a2ui/。
Canvas 命令(仅限前台):
canvas.eval、canvas.snapshot、canvas.navigate(使用{"url":""}或{"url":"/"}返回默认脚手架)。canvas.snapshot返回{ format, base64 }(默认format="jpeg")。- A2UI:
canvas.a2ui.push、canvas.a2ui.reset(canvas.a2ui.pushJSONL旧版别名)
camera.snap(jpg)camera.clip(mp4)
8) 语音 + 扩展的 Android 命令界面
- 语音:Android 在语音标签页中使用单个麦克风开/关流程,并具有转录捕获和 TTS 播放功能(配置时使用 ElevenLabs,否则回退到系统 TTS)。当应用离开前台时,语音会停止。
- 语音唤醒/交谈模式切换开关目前已从 Android UX/运行时中移除。
- 额外的 Android 命令系列(可用性取决于设备 + 权限):
device.status、device.info、device.permissions、device.healthnotifications.list、notifications.actionsphotos.latestcontacts.search、contacts.addcalendar.events、calendar.addcallLog.searchsms.searchmotion.activity,motion.pedometer
本页面源自 openclaw/openclaw,由 BeaversLab 翻译,遵循 MIT 协议 发布。