Raw Device Operations
pb provides high-level alias commands (tap, swipe, install, etc.) that cover common use cases. But the device exposes many more capabilities — SMS, contacts, sensors, permissions, and more — through its raw API.
Use pb list to discover all available APIs, pb info to see details, and pb -j to call them directly.
List APIs
pb list [filter]
Discover all available API endpoints on the connected device. Optionally filter by keyword.
Example:
pb list accessibility/get_hidden 获取无障碍服务隐藏状态
accessibility/node 操作 UI 节点
account/add 添加账号
account/list 获取账号列表
battery/get 获取电池信息
contact/add 添加联系人
contact/list 获取联系人列表
display/rotate 屏幕旋转
input/motion_event 发送原始 MotionEvent 事件
input/multi_click 多击
input/swipe 滑动
location/get_data 获取位置信息
location/set_data 设置位置信息
notification/list 获取活跃通知列表
package/clear_data 清除应用数据
permission/get 获取应用权限
permission/set 设置应用权限
sensor/list 获取传感器列表
sms/list 获取短信列表
sms/receive 接收短信(模拟发送短信)
system/get_prop 获取系统属性
system/set_prop 设置系统属性
...{
"code": 200,
"data": {
"input/swipe": { "title": "滑动" },
"sms/list": { "title": "获取短信列表" },
"contact/add": { "title": "添加联系人" },
"location/set_data": { "title": "设置位置信息" },
"..."
},
"msg": "OK"
}# Filter by keyword
pb list smsAPI Info
pb info <api>
Get detailed information about a specific API endpoint, including parameters, request examples, and response format.
| Parameter | Type | Required | Description |
|---|---|---|---|
api | string | Yes | API endpoint name (from pb list) |
Example:
pb info input/swipe input/swipe 滑动{
"code": 200,
"data": {
"input/swipe": {
"title": "滑动",
"content": "- URL: /input/swipe\n- Method: POST\n- Parameters:\n | Name | Type | Required | Description |\n | start_x | int | Yes | Start X |\n | start_y | int | Yes | Start Y |\n | end_x | int | Yes | End X |\n | end_y | int | Yes | End Y |\n | duration | int | No | Duration (ms), default 300 |"
}
},
"msg": "OK"
}Raw API Access
Call any device API directly using the -j (JSON body) or -f (file) flags. This is how you access APIs that don't have a dedicated alias command.
Example — send an SMS:
pb -j '{"address":"13800001234","body":"Hello from PhoneBase"}' sms/addExample — get battery info:
pb battery/getExample — show a toast message:
pb -j '{"text":"Hello!"}' system/toastRead JSON from file or stdin:
# From file
pb -f params.json sms/list
# From stdin
echo '{"type":1,"limit":10}' | pb -f - sms/list