Open segalion opened 3 years ago
Seconding this. I was about to suggest adding a way to capture Android events such as SLEEP, WAKE UP, etc. I was surprised it hasn't been already implemented
Well.. that is already implemented with the tasker plugin right?
Well.. that is already implemented with the tasker plugin right?
Yeah, exactly, it would be like reinventing the wheel from scratch. Tasker app already exists that can listen to such events and send commands to termux, either via Termux:Tasker or RUN_COMMAND intent. If Tasker being paid and closed source is an issue, there are other open source automation apps available. The amount of issues, specially device specific ones related to such event based systems are also a whole other world.
Yeah, exactly, it would be like reinventing the wheel from scratch.
A more "native" way would have been appreciated, especially in scripting. But I understand this is a great amount of work for something already functional, though not very satisfying:
Tasker app already exists that can listen to such events and send commands to termux, either via Termux:Tasker or RUN_COMMAND intent.
Can you tell us more about this RUN_COMMAND intent? I didn't find anything like this from my researches and nobody mentioned it when I asked what solution I could use
If Tasker being paid and closed source is an issue, there are other open source automation apps available.
Had several go on F-Droid, and I didn't find any. To be more precise, I found two, one that lacked many features (especially the one mentioned in this issues) and another that furthermore had an awful user interface. So yeah, I didn't find a decent alternative, but if there's one I'd be glad you share
Can you tell us more about this RUN_COMMAND intent?
The complete information about this intent is available at https://github.com/termux/termux-app/wiki/RUN_COMMAND-Intent
A more "native" way would have been appreciated
@termux can't implement everything. This is most likely not something any current maintainer has time to implement or maintain each year for android changes, specially when there are working alternatives. Currently, the termux apps and plugins already have a tonne of work to be done and a lot which hasn't been done for years. No benefit in doing it anyway specially with FOSS options, unless something is missing, which of course would still be better implemented upstream instead of termux specific.
Can you tell us more about this RUN_COMMAND intent
https://github.com/termux/termux-app/wiki/RUN_COMMAND-Intent
Some stuff has not been updated, check https://github.com/termux/termux-app/releases changelogs (0.115
). Tasker provides native TermuxCommand()
function in Tasker Function
action for RUN_COMMAND
intent but only supports executable
, args
, workdir
and background
extras. The am
command via Run Shell
action would not work without root
on android >=8
, termux-am
needs to be ported to tasker.
I didn't find any
Tasker has been in development since around 2007
and current owner joao has crazy speed of implementing new features, others would most definitely lack and did last I checked. Tasker also has workarounds for various android API restrictions which likely others don't.
Alright, thank you for this detailed answer
Welcome.
Isn't most of the code already there in SensorAPI.java for the termux-sensor script?
Add pseudo sensors as BroadcastReceivers for Wifi, Cell, Power and Battery events and we're good for most requirements.
Then users should send pull requests with such extra features and also reserve future time for maintenance and fixing bug reports.
Some years ago Termux amazed the whole world.
Since then, I find that there have not been too disruptive advances, and I have always been waiting for an asynchronous interface to be able to execute scripts associated with events ... Something like:
WHEN event(X) DO: That
All great termux-api are commands. But there isnt a "wait for event X" (calling to OS) to be asynchonous executed while minimice the batery usage (no pull every X seconds).
Usually this kind of program needs to "register" some kind of "callback", that will be called from lower level when event is fired. Typical example the old "bind" TCL/TK command (or tkinter python). About TCL, you could see how "androwish" are developing their 'borg' command integration with android (specially their event subcommand)
https://www.androwish.org/home/wiki?name=Android+facilities
I.e all automation android apps (like automagic) has their first "on event X" to launch a script. With termux, we have the power of almost all linux universe, but we need to interact with the Android system to create programs/scripts that will be launched on specific events.
I can imagine how comunicate with the entire world from my termux code (bash, python, termux-api ...), but I want to do this based on events like:
Please we need this kind of termux integration with android. I know it is hard, specially with google adding more and more security restrictions on every version, but I think this kind of feature is a "MUST HAVE".
Thanks in advance, and sorry if it is not the project where to open this kind of FR. I think I opened some request somewhere a few years ago.