# 几个常用api

在高版本的安卓系统当中有些api已经失效。

termux-api:

```
# 获取位置
termux-location

# 打开第三方app，如使用打开浏览器打开网页：
termux-open https://127.0.0.1:1024

#开关LED灯
termux-torch [on | off]

#访问电池信息
termux-battery-status

# 手机录音
termux-microphone-record

# 振动设备
termux-vibrate

# 设置壁纸
termux-wallpaper -f /sdcard/Picture/1.jpg

#在手机上显示消息
termux-toast

# 显示系统提醒
termux-notification [options]

# 电池优化
termux-wake-lock
termux-wake-unlock

# 打电话
termux-telephony-call 10086

# 创建内置sdcard软连接
termux-setup-storage

# 设置剪切板：
termux-clipboard-set 123
# 读取剪切板
termux-clipboard-get

# 重载termux设置
termux-reload-settings

# 显示toast
termux-toast 123
```

更多可以参考<https://bbs.zsxwz.com/thread-2720.htm>

小tips：`termux-`然后按tap键补全，即可查看termux使用的一些api


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://termux-wiki.zsxwz.com/ji-ge-chang-yong-cha-jian/untitled-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
