Skip to content

installing 04 termux api

yOyOeK1 edited this page Jan 28, 2022 · 1 revision

Termux api is a bridge for you to get information from your phone/tablet. End use it. Battery alarm, low storage warning, send sms, play sound, generate text to speech, ...

Termux api like termux is a apk application for android if you are running android >= 7.0 you can grab newest version from f-droid and install.

Go to f-droid.org find app "termux api" download newest version. DONE :) currently it's 0.50.1

installation is strat forward. After installation there will be no icon any ware. You can find it only in app in settings of android where you can force it to stop or confirm permissions. What we will change by going to settings -> apps -> find termux:api permissions turn on what you want to use.

On termux terminal site we need to get some things also. in termux terminal or ssh to it enter command

$ pkg install termux-api

it will install section of bridge to communicate from terminal to android layer.

testing termux api in termux terminal

enter command in termux terminal

$ termux-battery-status

it will spit out information about your device :) battery status

there is termux-am termux-notification-remove termux-api-start termux-open termux-api-stop termux-open-url termux-audio-info termux-reload-settings termux-backup termux-reset termux-battery-status termux-restore termux-brightness termux-sensor termux-call-log termux-setup-storage termux-camera-info termux-share termux-camera-photo termux-sms-inbox termux-change-repo termux-sms-list termux-clipboard-get termux-sms-send termux-clipboard-set termux-speech-to-text termux-contact-list termux-storage-get termux-dialog termux-telephony-call termux-download termux-telephony-cellinfo termux-fingerprint termux-telephony-deviceinfo termux-fix-shebang termux-toast termux-info termux-torch termux-infrared-frequencies termux-tts-engines termux-infrared-transmit termux-tts-speak termux-job-scheduler termux-usb commands to play with :) the roule is

$ termux-toast -help

to get info how to use it and what it's doing.

testing termux api and node red

turn web browser on and enter your node-red service. In my case it's http://192.168.43.241:1880 you will get to node-red service

top right corner menu import and past

[ { "id": "6b5cae6c63b4071d", "type": "inject", "z": "39529ae670192351", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "Hello I'm your oiysh terminal. Tallking to you from the tiny box. Let me out!", "payloadType": "str", "x": 120, "y": 120, "wires": [ [ "cfc0804bcad15a3a" ] ] }, { "id": "cfc0804bcad15a3a", "type": "termux-tts-speak", "z": "39529ae670192351", "name": "", "topic": "", "engine": "", "language": "", "pitch": 1, "rate": 1, "stream": "notification", "text": "", "x": 350, "y": 120, "wires": [] } ]

select "new flow" below and import. place nodes.

Deploy flow and test it by pressing squear from the left of "inject" node.

you will hear your device talking to you :)

Clone this wiki locally