This is an app exposing Android API to command line usage and scripts or programs.
When developing or packaging, note that this app needs to be signed with the same key as the main Termux app for permissions to work (only the main Termux app are allowed to call the API methods in this app).
Released under the GPLv3 license.
The termux-api client binary in the termux-api
package generates two linux anonymous namespace sockets, and passes their address to the TermuxApiReceiver broadcast receiver as in:
/system/bin/am broadcast ${BROADCAST_RECEIVER} --es socket_input ${INPUT_SOCKET} --es socket_output ${OUTPUT_SOCKET}
The two sockets are used to forward stdin from termux-api
to the relevant API class and output from the API class to the stdout of termux-api
.
Client scripts which processes command line arguments before calling the termux-api
helper binary are available in the termux-api package.
- Method for playing audio files using the system MediaPlayer, so
termux-play myfile.ogg
would play the audio file. - Wifi network search and connect.
- Proximity sensor.
- Accelerometer.
- LED Flash.