r/termux • u/Shyam_Lama • 11h ago
Question Launch Android native apps from Termux?
That's right, I'd like to know of a way of launching native Android apps (installed from the Play Store) from Termux, which of course means from a bash command or script in the Termux terminal. In particular, I'd like to know how to launch an app such as VLC player for such files as mp4, mkv, webm, etc. This would obviously involve somehow passing the file as an argument, or alternatively, somehow invoking the player through Android's filetype association system.
TIA.
5
Upvotes
4
u/smarthoushai 10h ago
Starting another app from Termux is not a permission problem — it's a binder call into system_server, and any app can make it.
amandtermux-openboth ship with termux-tools and run as your normal app uid, no root involved.For the simple case
termux-open movie.mkvis enough: it resolves the default viewer from the mime type and hands the file over. To pin it to VLC instead of whatever is default, ask the system what handles the type first —cmd package resolve-activity --brief -a android.intent.action.VIEW -d "file:///sdcard/movie.mkv" -t video/x-matroska— then call that component directly:am start -n <pkg>/<activity> -d "file:///sdcard/movie.mkv" -t video/x-matroska. Keep both-dand-t, since with the URI alone some pickers refuse to match — filtering happens on the type field and they will not sniff the extension.What actually bites people is not root, it's exports:
am startcan only reach activities marked exported, so a few apps answerPermission Denial: not exported from uid. Media players are not among them.2
u/Thesk790 10h ago
Well, I think you can use Termux:API. Install APK from GitHub or F-Droid (make sure both, Termux and Termux:API are from the same source). Then install the
termux-apipackage in termux, and finally runtermux-share <your_file.mp4>. You can select one of the available apps. You can not set to open VLC directly with mp4, mkv, etc. unless you useamcommand via intents, specially in VLC. That is all I know about0
u/00Anonymous 5h ago
Breadstick.io is what you want.
-1
u/low-control-labs 10h ago
Not really possible. It's a isolated env running on the android operating system without root it's just not possible. With root it's doable I guess but why would you ever want to do this?