返回顶部
o

oskill-proxyAndroid组件代理

Android组件调用代理。通过本地HTTP API在Android设备上启动Activity、启动Service、发送Broadcast、操作ContentProvider。当你无法直接执行Android Intent或组件调用时(例如在Termux环境中),使用此工具完成调用。

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
169
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

oskill-proxy

OSkillProxy — Android 组件调用代理

概述

OSkillProxy 是运行在 Android 设备上的代理服务。它提供本地 HTTP API,允许你以正确的 App 身份调用 Android 四大组件(Activity、Service、BroadcastReceiver、ContentProvider)。

使用前提

  • - OSkillProxy App 已安装并且代理服务已启动
  • Token 已配置(在 App 界面上查看)
  • 通过 http://127.0.0.1:8726 访问(端口可能已修改,以实际配置为准)

工具列表

start_activity

启动一个 Android Activity。
  • - 支持显式 Intent(指定 package + class)和隐式 Intent(指定 action)
  • 这是一个 fire-and-forget 操作,不返回 Activity 结果

start_service

启动一个 Android Service。
  • - 支持普通启动和前台服务启动

send_broadcast

发送一个 Android Broadcast。
  • - 支持普通广播和带权限限制的广播

query_provider

查询 ContentProvider 数据,返回结构化结果(列名 + 行数据)。

insert_provider

向 ContentProvider 插入数据,返回新记录的 URI。

update_provider

更新 ContentProvider 数据,返回受影响的行数。

delete_provider

删除 ContentProvider 数据,返回受影响的行数。

call_provider

调用 ContentProvider 的 call() 方法,返回 Bundle 结果。

调用方式

所有调用通过 HTTP POST 请求发起,使用 JSON 格式。

通用 HTTP 格式

bash
curl -X POST http://127.0.0.1:8726/api/v1/component/ \
-H Authorization: Bearer \
-H Content-Type: application/json \
-d

认证

每个请求(除 GET /api/v1/status 外)必须携带 Authorization header:

Authorization: Bearer <你的token>

通用响应格式

json { success: true, code: 0, message: ok, data: {}, requestId: abc12345 }

各端点详细说明

POST /component/activity/start

启动一个 Activity。

请求参数:

字段类型必填说明
packagestring目标包名
class
string | 否 | 目标 Activity 完整类名(需同时指定 package) |
| action | string | 否 | Intent Action |
| categories | string[] | 否 | Intent Categories |
| data | string | 否 | Intent Data URI |
| type | string | 否 | MIME Type |
| extras | object | 否 | Intent Extras,见 extras 格式 |
| flags | string[] | 否 | Intent Flags 名称列表 |

package+class(显式)或 action(隐式)至少提供一种。

支持的 Flags:

  • - FLAGACTIVITYNEWTASK(自动添加)
  • FLAGACTIVITYCLEARTOP
  • FLAGACTIVITYSINGLETOP
  • FLAGACTIVITYCLEARTASK
  • FLAGACTIVITYNOHISTORY
  • FLAGACTIVITYEXCLUDEFROMRECENTS
  • FLAGACTIVITYNEWDOCUMENT
  • FLAGACTIVITYMULTIPLETASK
  • FLAGINCLUDESTOPPEDPACKAGES



POST /component/service/start

启动一个 Service。

请求参数: 同 Activity,额外字段:

字段类型必填说明
foregroundboolean是否以前台方式启动(Android 8.0+)



POST /component/broadcast/send

发送一个 Broadcast。

请求参数: 同 Activity,额外字段:

字段类型必填说明
permissionstring接收方需要持有的权限



POST /component/provider/query

查询 ContentProvider。

请求参数:

字段类型必填说明
uristringContent URI
projection
string[] | 否 | 要查询的列 |
| selection | string | 否 | WHERE 条件(使用 ? 占位符) |
| selectionArgs | string[] | 否 | WHERE 参数值 |
| sortOrder | string | 否 | 排序规则 |

响应 data:
json
{
columns: [_id, title],
rows: [[1, Note 1], [2, Note 2]],
count: 2
}



POST /component/provider/insert

向 ContentProvider 插入数据。

请求参数:

字段类型必填说明
uristringContent URI
values
object | 是 | 要插入的键值对,格式同 extras |

响应 data:
json
{
uri: content://com.example.provider/notes/3
}



POST /component/provider/update

更新 ContentProvider 数据。

请求参数:

字段类型必填说明
uristringContent URI
values
object | 是 | 要更新的键值对 |
| selection | string | 否 | WHERE 条件 |
| selectionArgs | string[] | 否 | WHERE 参数值 |

响应 data:
json
{
affectedRows: 1
}



POST /component/provider/delete

删除 ContentProvider 数据。

请求参数:

字段类型必填说明
uristringContent URI
selection
string | 否 | WHERE 条件 |
| selectionArgs | string[] | 否 | WHERE 参数值 |

响应 data:
json
{
affectedRows: 1
}



POST /component/provider/call

调用 ContentProvider 的 call() 方法。

请求参数:

字段类型必填说明
uristringContent URI
method
string | 是 | 方法名 |
| arg | string | 否 | 字符串参数 |
| extras | object | 否 | Bundle 参数(简单 key-value,自动推断类型) |

响应 data: ContentProvider 返回的 Bundle 内容,序列化为 JSON 对象。



extras 类型说明

extras 字段支持两种格式:

格式 1:显式类型(推荐)
json
{
key: {type: string, value: hello},
count: {type: int, value: 42},
flag: {type: boolean, value: true}
}

支持的类型:string, int, long, float, double, boolean, stringarray, intarray, long_array

格式 2:自动推断
json
{
key: hello,
count: 42,
flag: true
}

自动根据 JSON 值类型推断。



使用示例

示例 1:启动一个 Activity(显式 Intent)

场景:启动录音应用的透明 Activity 进行录音控制

bash
curl -X POST http://127.0.0.1:8726/api/v1/component/activity/start \
-H Authorization: Bearer a3f8xxxxxxxxxxc9d2 \
-H Content-Type: application/json \
-d {
package: com.coloros.soundrecorder,
class: oplus.multimedia.soundrecorder.slidebar.TransparentActivity,
action: oplus.intent.action.STARTRECORDFROMCUBEBUTTON,
categories: [android.intent.category.DEFAULT]
}

示例 2:启动一个 Activity(隐式 Intent,带 extras)

bash
curl -X POST http://127.0.0.1:8726/api/v1/component/activity/start \
-H Authorization: Bearer \
-H Content-Type: application/json \
-d {
action: android.intent.action.SEND,
type: text/plain,
extras: {
android.intent.extra.TEXT: {type: string, value: Hello from agent!}
}
}

示例 3:查询 ContentProvider

bash
curl -X POST http://127.

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 oskill-proxy-1776278055 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 oskill-proxy-1776278055 技能

通过命令行安装

skillhub install oskill-proxy-1776278055

下载

⬇ 下载 oskill-proxy v1.0.0(免费)

文件大小: 3.79 KB | 发布时间: 2026-4-17 15:40

v1.0.0 最新 2026-4-17 15:40
Initial release of oskill-proxy — a local HTTP API proxy for Android component invocation.

- Provides endpoints to start Activity, Service, send Broadcasts, and operate on ContentProvider via HTTP.
- Supports both explicit and implicit Intents, extras with typed or auto-inferred parameters, and standard Android flags.
- API includes endpoints for querying, inserting, updating, deleting, and calling methods on ContentProviders.
- All actions require Bearer token authentication (except service status check).
- Includes detailed error codes and example requests for easy integration.
- GET /api/v1/status endpoint allows checking if the proxy service is up (no token required).

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部