Termux API Reference
This skill provides documentation for the Termux API. You can use the exec tool to run these commands directly.
Requirement: The user must have the
Termux:APIapp installed and thetermux-apipackage (pkg install termux-api).
Hardware & Sensors
Camera
Take a photo:
termux-camera-photo -c [0=back, 1=front] output.jpg
Example: termux-camera-photo -c 0 my_photo.jpg
Battery
Get status:
termux-battery-status
Returns JSON with percentage, health, and plugged status.
Torch (Flashlight)
Turn on/off:
termux-torch [on|off]
Location
Get current location:
termux-location
Returns JSON with latitude, longitude, and accuracy.
Microphone
Record audio:
termux-microphone-record -d [duration_in_seconds] -f [filename]
Example: termux-microphone-record -d 5 -f recording.mp3
System Integration
Clipboard
Get content:
termux-clipboard-get
Set content:
termux-clipboard-set "text to copy"
Notifications
Show notification:
termux-notification --title "My Title" --content "My Message"
Text-to-Speech (TTS)
Speak text:
termux-tts-speak [-l language] [-p pitch] [-r rate] "text to speak"
Parameters:
- •
-l [language]: Language to use (e.g.,en,fr,es,de). - •
-r [rate]: Speech rate (default: 1.0). - •
-p [pitch]: Speech pitch (default: 1.0).
Examples: Speak in English:
termux-tts-speak -l en "Hello, I am Picoclaw."
Speak in French:
termux-tts-speak -l fr "Bonjour, je suis Picoclaw."
WiFi
Get connection info:
termux-wifi-connectioninfo
Scan for networks:
termux-wifi-scaninfo
SMS & Telephony
Send SMS:
termux-sms-send -n [phone_number] "Message content"
Get Call Log:
termux-call-log -l [limit]
Setup Verification
To check if the API is working:
termux-battery-status
If this hangs or fails, the user might need to grant permissions to the Termux:API app on their phone.