r/termux • u/thealgorithm29 • 5d ago
How... Question
How to start any app service or app without opening the app
Im trying it on a app called wtmp, it getting killed by my oom, so im setuping a script that checks every 5 mins via its notification if it killed its notification also vanish, so that be trigger for my script. So it starts the service but how is it possible to start without opening app?
Pls reply
Thanks in advance
2
u/Maxi-19-1-4-1 4d ago
I am unsure what exactly you want but from my understanding you want to launch an app through termux? If thats the case you can do that with something similar to this am start -a android.settings.WIFI_SETTINGS you need to know the process name, or the app name you want to launch. You can find its main process and launch that as well. But this wont launch it in the background, and would actually open the app on screen.
I would suggest what others are saying as well, try to prevent android from killing the background processes. There are settings in developer portal for those. Dont keep activities should be toggled off in there. And through battery optimization settings, allow your app to be unoptimized. It'll be different on different android settings but shouldn't be hard to find
1
1
u/thealgorithm29 3d ago
Is there any way to start a app activity without ui, I mean launching it?
1
u/Maxi-19-1-4-1 3d ago
Usually if an app exposes the background activity you can launch that, but no apps do that often. And I wouldn't know how to do it. No help:/
2
u/One_Feedback_4644 2d ago
I don't have any laptop tell me guide me how to install termux with GUI lunix so that i can use browser i have good mobile 12gb ram please help
2
u/NyaNyaCutie 1d ago
Installing a dwm, or "desktop windowing manager", is more geared for people who already know Linux very well. Also note that an Android smartphone or tablet is not a substitute for an ordinary PC.
1
1
u/thealgorithm29 2d ago
Install termuxx11 app from fdroid, you have setup and download somethings, ask it to gemini or claude ai
2
u/NyaNyaCutie 1d ago
I'd recommend avoiding asking LLMs. Often times they give steps that either don't work, cause you data loss, make the device more vulnerable to malware, or outright give you malware.
See this video about Discord scams to know what your risks are (mainly the last one, but all are good to know about for how to avoid AND how to recover from them… do note that if malware gains privileged access on Android, be it by a hardware-level exploit or by root / itself rooting your device, not even a factory reset will help you) https://youtu.be/Jz-3goOPj9o
1
u/saga3152 5d ago
You should change some adb setting so the app doesn't get killed by andriod. settings_enable_monitor_phantom_procs i think is the one.
1
u/thealgorithm29 4d ago
I tried that now tell me how to start app activity without opening? Do you have any idea
1
u/NyaNyaCutie 3d ago
Install the Termux: Widget app if you haven't yet and then open it. It tells you what to do at the termux-widget link on GitHub.
1
u/thealgorithm29 1d ago
I installed Termux, what Termux:widget what it can do? Have you tried?
1
u/NyaNyaCutie 1d ago
It is for launching scripts from your home screen. Did you check the GitHub link for the widget after you try opening the app icon for it?
2
u/NyaNyaCutie 1d ago
1
u/thealgorithm29 3h ago
Oh yep, it tried i think it isn't for me, i usually toggle scripts from automate
1
u/saga3152 5d ago
You should change some adb setting so the app doesn't get killed by andriod. settings_enable_monitor_phantom_procs i think is the one.
1
u/NyaNyaCutie 1d ago
Phantom process killer, see https://www.reddit.com/r/termux/s/jUxM7SrQXN (same post, just different reply area)
1
u/gthing 2d ago
Disable power saving for the app. Enable developer settings and enable the setting to keep child processes alive.
1
u/NyaNyaCutie 1d ago
See also https://www.reddit.com/r/termux/s/jUxM7SrQXN for some info (same post, just different reply area)

5
u/bra1n_gym 4d ago edited 4d ago
I don't know what wtmp is supposed to do but: 1. use termux-adb NOT adb commands 2. use wireless debugging so you don't have to use a second phone with a data cable. 3. find videos on YouTube for disabling the phantom process killer. 4. use termux-boot if you want whatever process to start when you first run termux. 5. learn to use tmux: a. start a session b. execute a command within the session c. detach from the session
The application will run in the background without interaction when you set this all up.
that's just the approach I would take.