Cell phone apps are greedy. They spy on us, listen in on our conversations. They run in the background and drain your battery. A lot of “features” are nuisances. But we also need them, want them, and use them, despite the problems.
To combat this problem, I created a method of disabling apps while not in use, then enabling them on-demand. The result is a seamless experience… There’s a complicated setup process, but it works, and I’ve been using it successfully for a couple years now. There are root and non-root methods.
The process uses shell scripts stored on the phone to enable and disable apps. The shell scripts are triggered by actions in Tasker. When you want to launch an app that has been disabled, Tasker executes the shell script to enable it, and then launches the app. When you move on to another app, Tasker executes the disable script. The whole process is packaged in an app created by Tasker. I use this process on Facebook and Instagram, but it would work for any app.
Requirements:
Install Termux
Termux is a terminal emulator for Android. It is required for both the root and non-root methods.
- Download and install the arm64 version of Termux from https://github.com/termux/termux-app/releases. Do not install Termux from Google Play.
- Open termux and update and install android-tools:
pkg update
pkg install android-tools Root Method
You need to be able to run ADB commands to enable and disable apps. These permissions easily granted when you have root. Simply open Termux, and when you run a command that requires root permission in the steps below, grant Termux root access when prompted.
Non-root Method
Without root, we’ll need to install Shizuku and configure it to work with Termux. Shizuku helps other apps access system-level features without needing root.
Install Shizuku
Install Shizuku from Google Play.
Configure Shizuku to work with Termux
Shizuku must be manually configured to work with Termux. This is a complicated process that is described in the Shizuku documentation, with additional details for Termux integration below.
- Open Shizuku and click on “Use Shizuku in terminal apps” to begin the export process. Click on “Export files” and export the rish files to temporary location on the sdcard.
- Edit the exported rish file, substituting PKG with “com.termux”:

- Open Termux, copy the exported rish files to the Termux user bin, and set execute permissions:
termux-setup-storage
cd /sdcard/temp_folder/
cp rish /data/data/com.termux/files/usr/bin && cp rish_shizuku.dex /data/data/com.termux/files/usr/bin
cd /data/data/com.termux/files/usr/bin
chmod +x rish && chmod +x rish_shizuku.dex 
Start the Shizuku service
- Open Shizuku and click on “Pairing”.
- Follow the instructions to open Developer Options and pair Shizuku.
Note that Shizuku must be paired with the device each time the phone restarts.
Configure Termux to Work with Tasker
- Download and install termux-tasker from https://github.com/termux/termux-tasker/releases.
- Create termux-tasker folder in termux home: /data/data/com.termux/files/home:
mkdir -p .termux/tasker - Grant permissions for Tasker to interact with Termux:
Settings -> Apps -> Tasker -> Permissions -> Additional permissions -> Run commands in Termux environment
Create Tasker Tasks
Tasker manages the enabling and disabling of the app based on certain triggers. To configure this, we’ll first need to create two files: one to enable the app and one to disable the app. We’ll create these files in /data/data/com.termux/files/home/.termux/tasker:
nano enable_instagram.sh
rish -c 'pm enable-user --user 0 com.instagram.android' nano disable_instagram.sh
rish -c 'pm disable-user --user 0 com.instagram.android' - It can be difficult to type on a phone. If it’s easier, create the files on a computer, copy them to the phone, and then copy them to /data/data/com.termux/files/home/.termux/tasker:
cp /sdcard/download/disable_instagram.sh /data/data/com.termux/files/home/.termux/tasker
chmod +x /data/data/com.termux/files/home/.termux/tasker/disable_instagram.sh - Create a task in Tasker called “Instagram Launcher”, or something similar. The task will have two actions, one to enable Instagram, and the other to launch it.
- Add Action -> Plugin -> Termux:Tasker. Edit the configuration to reference the enable shell script:

- Add an action to launch Instagram.
- This script will not have a profile or action that triggers it. We’re going to create a app from it instead.
- Next create a task in Tasker called “Disable Instagram”, or something similar. The task will have one action that disables Instagram.
- Add Action -> Plugin -> Termux:Tasker. Edit the configuration to reference the disable shell script.
- Create a Profile that executes when an app is launched. Set the exit task to Disable Instagram. This will execute the script to disable Instagram when it loses focus on your phone.
Reference:
https://github.com/termux/termux-tasker
Create App from Task
- First find an icon to use for the launch app. I use an Instagram icon I found online. Set it as the Instagram Launcher tasks icon.
- Use Tasker’s Export > To App function to create a standalone launch app. Be sure the Termux plugin is selected and add Extra Permissions: com.termux.permission.RUN_COMMAND.

- Install the app on your phone. After install, grant permissions for app to interact with Termux:
Settings -> Apps -> custom_app -> Permissions -> Additional permissions -> Run commands in Termux environment. - You now have an app that enables and launches Instagram, and a Tasker task that disables Instagram when it’s not in use.
Minor Annoyances
- Slight delay on launch
- Manual app update process
- For non-root method, Shizuku must be re-paired with the device on reboot
