[Tasker Tips & Tricks] Lord Sithek:
[EDIT 2: 1.07.2024] Another small update; eliminated the need to long press the volume key, now the project just detects the pairing code prompt

[EDIT: 30.06.2024] Project slightly updated - added some useful toasts and made the main task stop if WiFi connection hasn't been detected within 1 minute

This is simplified version of the project posted here

Somehow I've felt a burst of motivation to get back to this project :) But this time I wanted to simplify it as much as possible. If anyone wants to use more advanced techniques, please search through the various ideas and projects posted over last months, like here, here and here.

I added a profile which automatically accepts debbuging prompts (screen needs to be on). Also when device boots, a child task is executed to suspend the main task until the screen is unlocked. Then the main task waits for WiFi to be connected.

DOWNLOAD PROJECT FROM TASKERNET

In this project I used some great methods created by users from Reddit much more skillful than me. Credits especially to u/The_IMPERIAL_One and u/BillGoats, as well as u/Ratchet_Guy, u/anuraag488, u/aasswwddd, u/cm2003, u/DutchOfBurdock and others who have contributed and made it possible.

I'm copying parts of the instruction from the original post which are still valid (with some edits):

The project requires some manual one-time actions to set everything up, but once it's done, all you should need is to unlock the phone after boot.

Prerequisites:

Termux

Termux:Tasker plugin

AutoInput plugin

I assume you have above-mentioned apps installed and that you already enabled Developer Options and Debugging on your device.

1. Setup Tasker and AutoInput

If you haven't done that before, grant Tasker following permissions:

WRITE_SECURE_SETTINGS

Run commands in Termux environment:

On your device, go to Settings > Apps > All apps > Tasker > Permissions > Additional permissions > Run commands in Termux environment (the path may vary a little according to the brand and system) and select Allow.

Allow AutoInput to use Accessibility Service:

Open AutoInput, tap on red warning text and click OK; this should take you to Accessibility Service settings. Enable it for AutoInput. Then allow AutoInput to run in background by disabling any battery saving option for this app.

2. Set up Termux

(a) install android-tools package

Open Termux and issue this command:

pkg install android-tools

Confirm downloading in terminal if needed by typing y and Enter on keyboard.

(b) set allow-external-apps property for Termux to true

In Termux, copy & paste the following script and confirm by pressing Enter:

value="true"; key="allow-external-apps"; file="/data/data/com.termux/files/home/.termux/termux.properties"; mkdir -p "$(dirname "$file")"; chmod 700 "$(dirname "$file")"; if ! grep -E '^'"$key"'=.*' $file &>/dev/null; then [[ -s "$file" && ! -z "$(tail -c 1 "$file")" ]] && newline=$'\n' || newline=""; echo "$newline$key=$value" >> "$file"; else sed -i'' -E 's/^'"$key"'=.*/'"$key=$value"'/' $file; fi

3. Pair your device with ADB and enable ADB WiFi

Make sure that all profiles in your new Tasker project are enabled and that you have WiFi connection.

On your device, navigate to Settings > System > Developer options > Wireless debugging (the path may vary a little depending on the brand and system). Enable this feature. If debugging prompt appears meantime, it should be automatically accepted, otherwise accept it manually. Next, tap on Pair device with pairing code (or similar).

A prompt with the pairing code should appear and the proccess of pairing should start automatically. If a debugging prompt appears meantime, it should be automatically accepted, otherwise accept it manually. If pairing succeeded, you should see at least one paired device at the Wireless debugging screen, named as xxx@localhost.

ADB Pairing profile should get disabled as it won't be needed anymore. Now, Enable ADB WiFi task starts. You will be informed with a toast and a notification if ADB WiFi has been enabled. If not, you can repeat the process by tapping on the error toast or on the notification button Try again.

Optionally, if you use Shizuku service, you can enable it automatically on boot as well. To that end, enable action labeled as [OPTIONAL] Start Shizuku service in Enable ADB WiFi task.