1
0
mirror of https://github.com/danog/termux-api.git synced 2024-11-29 20:09:00 +01:00
termux-api/README.md

31 lines
1.7 KiB
Markdown
Raw Permalink Normal View History

Termux API
==========
2016-01-13 01:31:07 +01:00
[![Join the chat at https://gitter.im/termux/termux](https://badges.gitter.im/termux/termux.svg)](https://gitter.im/termux/termux)
This is an app exposing Android API to command line usage and scripts or programs.
2015-12-27 12:13:24 +01:00
- [Termux:API on Google Play](https://play.google.com/store/apps/details?id=com.termux.api)
2015-12-27 12:22:25 +01:00
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).
License
=======
Released under the [GPLv3 license](http://www.gnu.org/licenses/gpl-3.0.en.html).
2016-02-20 17:04:31 +01:00
How API calls are made through the termux-api helper binary
===========================================================
2017-10-22 21:03:47 +02:00
The [termux-api](https://github.com/termux/termux-api-package/blob/master/termux-api.c) client binary in the `termux-api` package generates two linux anonymous namespace sockets, and passes their address to the [TermuxApiReceiver broadcast receiver](https://github.com/termux/termux-api/blob/master/app/src/main/java/com/termux/api/TermuxApiReceiver.java) as in:
2015-07-26 02:40:28 +02:00
2015-12-27 12:22:25 +01:00
/system/bin/am broadcast ${BROADCAST_RECEIVER} --es socket_input ${INPUT_SOCKET} --es socket_output ${OUTPUT_SOCKET}
2015-07-26 02:40:28 +02:00
2015-12-27 12:22:25 +01:00
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
==============
2017-08-08 14:02:44 +02:00
Client scripts which processes command line arguments before calling the `termux-api` helper binary are available in [the termux-api package](https://github.com/termux/termux-api-package).
2015-07-26 02:57:56 +02:00
Ideas
=====
2015-07-26 18:51:37 +02:00
- Wifi network search and connect.
- Add extra permissions to the app to (un)install apps, stop processes etc.