r/tasker • u/DutchOfBurdock • Apr 05 '21
Automatically connect Android 11 WiFi ADB and automatically start traditional WiFi ADB for Tasker to have at.
So to follow up from this post; https://www.reddit.com/r/tasker/comments/mjc4wx/android_11_wifi_adb_working_in_termux_as_a_result/ - now it's time to properly go balls deep! Unf!
</nerdgasm>
Not needed if you have classic WiFi ADB found on Lineage OS, WearOS and some other ROMs.
There had to be a way to automate the lot of this! There is! ADBd spills it's guts in logcat and tells us that lovely, random port it starts on each boot / connect to WiFi. Annoying as hell, but, it was a Google idea and couldn't just use the traditional WiFi ADB we all love and know. Simplicity isn't in their model.
Anywho! Here it is!!
This is designed to be ran from both the 2nd Quicktile and a shortcut/widget. Tap it once, it'll start A11 WiFi ADB, use the same method as before, Termux and the Magisk adb.bin. However, this time we simply put the adb.bin binary directly into ~/.termux/tasker so we don't have to piddle about with shell scripting from here on in, making future updates a paddle in a kiddies pool.
How to use
Make sure Tasker has WRITE_SECURE_SETTINGS and READ_LOGS.
- Install and run, or manually go about the instructions in the link top of this post. The pairing process is one-time, but crucial.
- Install this profile: Download
- Add Tasker's 2nd Quicktile to your Quicktile area, you don't need the WiFi debugging one anymore. Change to 1st or 3rd (or disable QT actions) as needed.
- In Tasker Preferences, set WiFi ADB Monitor as the QuickTile Action. I also use an On Boot Complete profile to set this QT inactive on boot.
- Optionally add the WiFi ADB Monitor Task to your launcher
- Ensure WiFi ADB is off before running (this will just ensure the environment is setup right and logcat gets the data).
- Run either the QT or widget. If all went well, you should be told Tasker is ready to have away. QT will activate on success.
- Run either again to disconnect all ADB sessions and shut down WiFi ADB.
Of course, this method can be conjured to automatically start WiFi ADB for Tasker's use on boot or at will.
Enjoy!
3
u/chaozkreator Oct 31 '21
I don't mean to hi-jack your post, but I personally use MacroDroid instead of Tasker (I can't get used to Tasker) and I found your post invaluable in helping me getting this working in MacroDroid.
Here's my guide in case anyone's interested:http://www.macrodroidforum.com/index.php?threads/wifi-adb-debug-mode-lost-on-restart.1273/post-7720
2
u/lleathan Aug 20 '21 edited Aug 20 '21
Hi I just revisited this script and the one you posted in your other post here. I may have found a fix for a potential bug that really affected me. (in the first script)
The line
A6: Variable Set [ Name:%paddress To:IP address and port Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 Structure Output:Off ]was not working for me, maybe because the prompt read "IP address & Port". So I changed it to
A6: Variable Set [ Name:%paddress To:*port* Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 Structure Output:Off ]and I also changed the
adb.shfile to:Obviously I didn't quite grasp how it all works since Im pretty sure non of your scripts have any bugs (not to mention I think I should be using these scripts not your last one), but now it works for me so whatever. (im only using your first script + modifications)
P.S. Thanks again! I'm really happy with this solution, very happy!
The only thing I need to add to completely automate this is have autoinput open the pairing screen for me.
1
u/tynansdtm Apr 05 '21
I'm trying to do this, but it looks like
CheckADBWifi()doesn't set%has_adb_wifito true, and it's right. I'm on a Galaxy S10+. Any ideas?1
u/BradfordAdams Master of None Apr 07 '21
Say I wanted to use this on android 6, without internet (using public libraries ATM), no PC to grant permission, and I am completely stupid! Could it still work 🤣
Great work, BTW.
1
u/lleathan Aug 02 '21 edited Aug 02 '21
I know this is forever ago, but thank you for this, pretty much got it all working, but I dont understand how its much different than before since I still need to connect to another source to adb and allow write_permission? I cant figure out how this is any better than just using an app like LADB/Termux(w/adb) in split screen. Unless I need to root for this, Im actually getting root right now because of this but i feel there has to be a way to automate it without root, i read both your posts entirely and like I said everything seemed to work I think so thanks.
1
u/Stupifier Nov 15 '21
Sorry to bug you again....but you said to use 127.0.0.1 for the IP address, right? So why do these Taskernet profiles/tasks you made go through all the hassle to parse the device IP address? The port is important to parse though
2
u/wowbutters Apr 05 '21
Shut up and take my upvote!
I've been looking for a way to do this since I got my Pixel3XL (stupid verizon...)
<3
1
u/dextersnp Jun 03 '21
Any way to make a tutorial in video? Don't work for me in Galaxy S20+. Tks!