I am using an FOSS app called Automation Git repo, it doesn’t allow me to directly open Android Apps except if I use scripts. I don’t know what scripts it’s talking about, but I am trying to learn. Just like there are bash shell scripts, are there android scripts
or something of the sort?
Also, Is it possible to open an Android Application (KDE Connect) using Termux cli on Android? I don’t want to do pkg install kdeconnect
I think it works. But, is it possible to run applications such as kde connect
android, syncthing
android using termux?
Automation can run apps, you just need to specify an activity too. Usually it’s the Main activity if you just want to run the app normally.
You can do:
monkey -p your.app.package.name -c android.intent.category.LAUNCHER 1
I am trying to run KDE Connect
Where should I run this from? Termux?
Also, do I have to use a shebang line like we do for linux
#!/bin/bash
for bash, do I need anything like that here?
Automation can open an app without the need for scripts. Add action > Start another program > Select app > KDE Connect > Find automatically
EDIT: Running this from Termux will launch KDE Connect:
am start --user 0 -n org.kde.kdeconnect_tp/org.kde.kdeconnect.UserInterface.MainActivity
thank you!!
If you install a terminal emulator like Termux, you can use any script your phone has an interpreter for. You can also install other interpreters if you wish.
For most phones,
sh
is the best you can hope for (and no, it’s not thesh
that’s secretly a soft link tobash
).Through Termux I’ve personally installed Python and zsh, though other apps can’t really call into those because of the sandboxing Android applies, the same way Docker containers can’t just call each other’s binaries.
There are various tools you can use to launch Android apps, however, Android apps aren’t just binaries like on the desktop. They’re packages exporting various applications and activities to the system, some of which are registered into launchers to add a launch icon. An app can add 100 icons in your launcher or have no icon whatsoever; many libraries do have activities that can be opened, but nothing you can access from any nornal launcher. If you don’t read up on the Android activities paradigm, you’re going to be very confused about how launching apps works.
If you can figure out the activity for an app,
am
andmonkey
can be used to launch apps and activities. For example:am start -a android.intent.action.MAIN -n com.android.settings/.Settings
will launch the settings app.
As for automating this behaviour, most phones will kill daemons in the background, and daemons will waste battery life like crazy. You can keep a Termux she’ll active in the background and run normal scripts through there, but that’ll take hours of your battery life.
It’s better to use dedicated Android apps for scripting the UI, because they can make use of the power saving features built into Android better. Apps like tasker are a popular way to do this. Those apps often also automate the process of finding out the exact name and path of the activity you’re trying to activate.
hey, thank you very much for this
thank you for this! I figured it out somehow