I guess if you are reading this, it's because you liked the first part of this gist π
I hope this second part will please you even more!
Note
Google have decided to force all developpers to register to a central authority. This will endanger projects and services like F-droid and so by extention IzzyOnDroid repo and the Droid-ify project.
You can read more about it here: https://f-droid.org/2025/09/29/google-developer-registration-decree.html
- Running ADB on and from your own Android device -- Part 2
Termux in itself is already quite useful but you can even extend it even more with several extensions!
- Termux:API: Gives access to notifications, device gps, microphone, camera and so much more
- Termux:Boot: Gives the possibility to run a script at boot
- Termux:Widget: Gives the possibility to run a script from the homescreen
These three plugins will be really useful in the next sections. π
Note
There are a few other Termux extensions that exists like:
- Termux:Float: Gives the possibility to run Termux in a floating window
- Termux:GUI: Gives the possibility to use the Android GUI from terminal applications
- Termux:Styling: Gives the possibility to customize the Termux terminal
- Termux:Tasker: Gives the possibility to run Termux scripts from Tasker
But they won't be covered here.
In case you want them, you can find them all in Droidi-fy.
Install Termux:API from Droidify or F-Droid and do the following:
- Start the Termux application
- Run this command:
apt update && apt install -y termux-api
Important
You need to have both, the Termux:API application and the termux-api package installed.
The Termux:API application provides the backend required by the commands provided by the termux-api package.
Tip
If you want to see all commands provided by the termux-api package, then type termux- and hit [TAB] twice.
Note
Some commands required by the script for starting Shizuku at boot comes from the termux-api package.
Install Termux:API from Droidify or F-Droid and do the following:
- Start the Termux application
- Run this command:
mkdir -pv ~/.termux/boot
Now you can place any scripts that you want to be executed at boot in the ~/.termux/boot folder.
Warning
If there are multiple files, they will be executed in a sorted order.
So if you want to control the execution order of your scripts, you should prefix them with digits like this:
01-first-script.sh02-second-script.sh03-third-script
And so on...
Important
The first line of your script must be replaced by:
#!/data/data/com.termux/files/usr/bin/bash for Bash
And by:
#!/data/data/com.termux/files/usr/bin/sh for Sh
IF YOU DON'T DO THAT, YOUR SCRIPTS WILL NOT BE EXECUTED!!
Install Termux:Widget from Droidify or F-Droid and do the following:
- Start the Termux application
- Run this command:
mkdir -pv ~/.shortcuts
Now you can place any scripts that you want to be executed from the homescreen in the ~/.shortcuts folder.
Important
The first line of your script must be replaced by:
#!/data/data/com.termux/files/usr/bin/bash for Bash
And by:
#!/data/data/com.termux/files/usr/bin/sh for Sh
IF YOU DON'T DO THAT, YOUR SCRIPTS WILL NOT BE EXECUTED!!
Ok, now that you (normally) have Termux installed with the three plugins as explained in the previous section, you can keep reading to finally be able to run priviledged apps or commands without having to root your device. π
The first thing you have to do in order to be able to run privileged apps or commands is to install Shizuku.
Tip
You can find the source code here: https://github.com/RikkaApps/Shizuku
You can also read their API which is pretty interesting.
Note
The recommanded install method is to use Droidi-fy.
Unfortunately, you can't start Shizuku automatically at boot without rooting your Android device.
By chance, I've found a way to do it by using a shell script that can be started at boot with the Termux:Boot plugin.
You can use the code below and modify it according to your needs.
#!/data/data/com.termux/files/usr/bin/bash
# Options
[[ -r $HOME/.debug ]] && set -x
# Functions
wait_for_init() {
termux-wake-lock
sleep 30s
}
wait_for_end() {
sleep 10s
termux-wake-unlock
}
notify() {
termux-notification -t "Termux ADB" -c "$1" --icon "$2" --id 1337
}
notify_remove() {
termux-notification-remove 1337
}
toast() {
termux-toast "$*"
}
adb_server_reset() {
adb kill-server && adb start-server
}
adb_list_devices() {
adb devices -l
}
get_adb_port() {
nmap -v0 127.0.0.1 -T5 -p30000-65535 -oX - | grep -m1 'state="open"' | grep -m1 "<port " | cut -d'"' -f4
}
# Main
notify "Initializing... Please enable Wireless Debugging." "warning"
wait_for_init
notify "Starting ADB..." "info"
toast "Restarting ADB server..."
adb_server_reset &>/dev/null
toast "Detecting ADB connection port..."
FOUND_ADB_PORT=$(get_adb_port)
if [[ -n $FOUND_ADB_PORT ]]; then
toast "Found port: ${FOUND_ADB_PORT}"
toast "Connecting to ADB..."
adb connect "localhost:${FOUND_ADB_PORT}" | termux-toast
toast "Searching for connected devices..."
adb_list_devices | termux-toast
notify "Starting Shizuku..." "lightbulb"
adb shell /data/app/~~GBpxmYQKGPC_qX6vSCt0eA==/moe.shizuku.privileged.api-ht7T9IX8AmvW1_6jo5sCeA==/lib/arm64/libshizuku.so
RET_CODE_SHIZUKU=$?
if [[ $RET_CODE_SHIZUKU == 0 ]]; then
notify "Shizuku started." "verified"
else
notify "Failed to start Shizuku." "error"
fi
else
notify "Wireless debugging not started." "report_problem"
fi
wait_for_end
notify_removeSave the code above in ~/.termux/boot/01-start-shizuku.sh and make it executable.
Warning
The adb shell command responsible for starting Shizuku might be different on your side. If so, please write a comment and I'll make this part configurable with a variable.
Tip
You can name your script with or without the .sh extension. It does not matter as long as your file has the executable bit set.
In case your Android device is already started and want to manually start Shizuku, you can use the script below.
#!/data/data/com.termux/files/usr/bin/bash
# Options
[[ -r $HOME/.debug ]] && set -x
# Functions
adb_server_reset() {
adb kill-server && adb start-server
}
adb_list_devices() {
adb devices -l
}
get_adb_port() {
nmap -v0 127.0.0.1 -T5 -p30000-65535 -oX - | grep -m1 'state="open"' | grep -m1 "<port " | cut -d'"' -f4
}
# Main
echo -e "\nInitializing...\n"
termux-wake-lock
echo -e "\nRestarting ADB server...\n"
adb_server_reset
echo -e "\nDisplaying connected devices...\n"
adb_list_devices
echo -e "\nDetecting ADB connection port...\n"
FOUND_ADB_PORT=$(get_adb_port)
if [[ -n $FOUND_ADB_PORT ]]; then
echo " - Found port: ${FOUND_ADB_PORT}"
echo -e "\nConnecting to ADB...\n"
adb connect "localhost:${FOUND_ADB_PORT}"
echo -e "\nDisplaying connected devices...\n"
adb_list_devices
echo -e "\nStarting Shizuku...\n"
adb shell /data/app/~~GBpxmYQKGPC_qX6vSCt0eA==/moe.shizuku.privileged.api-ht7T9IX8AmvW1_6jo5sCeA==/lib/arm64/libshizuku.so
RET_CODE_SHIZUKU=$?
if [[ $RET_CODE_SHIZUKU == 0 ]]; then
echo -e "\nShizuku started.\n"
else
echo -e "\nFailed to start Shizuku.\n"
fi
else
echo -e "\nWireless debugging not started.\n"
fi
read -rp "Press [Enter] to exit..."
echo -e "\nClosing...\n"
termux-wake-unlockSave the code above in ~/.shortcuts/start-shizuku and make it executable.
Warning
The adb shell command responsible for starting Shizuku might be different on your side. If so, please write a comment and I'll make this part configurable with a variable.
Note
The script linked to the homescreen widget does not have the .sh extension.
This is because the widget is created based on the file name and I found it ugly to see the file extension.
Now that you (normally) have Shizuku installed, you can now install Canta to remove any applications that are preinstalled on your Android device that usually can't be removed without root.
Tip
You can find the source code here: https://github.com/samolego/Canta
Note
The recommanded install method is to use Droidi-fy.
Important
Once you have installed Canta, you must authorize it in Shizuku. You should be prompted to do when starting the application.
Caution
Be very careful when removing system applications as you might simply brick (break) your Android device!
Now that you (normally) have Shizuku installed, you can now install Amarok.
Tip
You can find the source code here: https://github.com/deltazefiro/Amarok-Hider
Note
The recommanded install method is to use Droidi-fy.
Important
Once you have installed Amarok, you must authorize it in Shizuku. You should be prompted to do when starting the application.
Now that you (normally) have Shizuku installed, you can now install TaskManager in case you want to kill some annoying process or simply want to quickly get more details about it.
Tip
You can find the source code here: https://github.com/RohitKushvaha01/TaskManager
Note
The recommanded install method is to use Droidi-fy.
Important
Once you have installed TaskManager, you must authorize it in Shizuku. You should be prompted to do when starting the application.
Thanks to the Shizuku dev who created RISH! πββοΈ
rish is an Android program for interacting with a shell that runs on a high-privileged daemon process.
To deploy it, just open Shizuku and do the following:
And make the rish file executable if it's not already.
Once done, you can do some tests like below:
If you want to have rish in your Termux path, then simply copy both files rish and rish_shizuku.dex in the $PREFIX/bin folder that way:
cp -v rish* $PREFIX/bin/Note
You can also run an elevated shell by simply running rish without arguments.
It's simple as that π
Now, the rest of the fun is up to you π
- https://droidify.eu.org/
- https://f-droid.org/en/packages/com.termux/
- https://f-droid.org/en/packages/com.termux.api/
- https://f-droid.org/en/packages/com.termux.boot/
- https://f-droid.org/en/packages/com.termux.widget/
- https://apt.izzysoft.de/fdroid/index/apk/in.hridayan.ashell
- https://github.com/DP-Hridayan/aShellYou
- https://apt.izzysoft.de/fdroid/index/apk/moe.shizuku.privileged.api
- https://github.com/RikkaApps/Shizuku
- https://github.com/RikkaApps/Shizuku-API
- https://github.com/RikkaApps/Shizuku-API/tree/master/rish
- https://apt.izzysoft.de/fdroid/index/apk/io.github.samolego.canta
- https://github.com/samolego/Canta
- https://apt.izzysoft.de/fdroid/index/apk/deltazero.amarok.foss
- https://github.com/deltazefiro/Amarok-Hider
- https://apt.izzysoft.de/fdroid/index/apk/com.rk.taskmanager
- https://github.com/RohitKushvaha01/TaskManager
- https://github.com/DP-Hridayan/aShellYou/wiki/Wireless-Debugging-Setup
- https://shizuku.rikka.app/guide/setup
I'd like to thank the following persons:
- K3RN3L P4N1K for his help with Termux:Widget
- Skyper from the THC group for his help and support in general
Thank you guys!
- Jiab77


