FORUMS
Remove All Ads from XDA

[Plugin] Remote Adb Shell

1,138 posts
Thanks Meter: 274
 
By Humpie, Senior Member on 23rd February 2017, 05:53 PM
Post Reply Email Thread
Hi everyone!

I just created my first Tasker plug-in. This plug-in enables you to send an adb shell command to any other device on the network that has adb over wifi enabled. I for example use it to turn my androidtv on or off by sending it the command "input keyevent POWER". You can also open specific activities in apps for example or simulate touch input.

Please read the description before using it and don't hesitate to leave feedback/bug reports/tips! This is my first app ever published so I still have a lot to learn.

You can download it for free from the play store:
https://play.google.com/store/apps/d...=com.ADBPlugin

Edit: It's now also available on XDA Labs! You can find it here
The Following 9 Users Say Thank You to Humpie For This Useful Post: [ View ] Gift Humpie Ad-Free
 
 
25th February 2017, 05:32 PM |#2  
First update is live!
This includes proper (cat)logs and Tasker errors if something went wrong, so if you run in any problems, you can now tell me . It also plays a lot nicer with the Tasker timeout system.
26th February 2017, 01:48 PM |#3  
Member
Thanks Meter: 30
 
More
@Humpie
Thanks for this plugin. I allready made a project for my sony android tv. Start apps and controll media play.

But to make the plugin better I have some featur requests:
It would be nice to be able to work with tasker variables. e.g input text "%mytext".
Another feature reqest would be to get a output variable for commands with output like adb shell pm list packages.
The Following User Says Thank You to MartelKombat For This Useful Post: [ View ] Gift MartelKombat Ad-Free
26th February 2017, 04:46 PM |#4  
Quote:
Originally Posted by MartelKombat

@Humpie
Thanks for this plugin. I allready made a project for my sony android tv. Start apps and controll media play.

But to make the plugin better I have some featur requests:
It would be nice to be able to work with tasker variables. e.g input text "%mytext".
Another feature reqest would be to get a output variable for commands with output like adb shell pm list packages.

Thanks for the tips! Will definitely add variable support and I'll also have a look at output variables. They are visible in the logs already, but not yet to tasker.
27th February 2017, 06:14 AM |#5  
Senior Member
Thanks Meter: 88
 
More
Why can't we use the built-in code Acton in Tasker? Is there a difference?
27th February 2017, 10:37 AM |#6  
Quote:
Originally Posted by loogielv

Why can't we use the built-in code Acton in Tasker? Is there a difference?

In fact there is, since android 4.something google removed adb from android devices, so you can't perform adb commands from your phone, well aside from my plugin that is.
There would however be no difference if your remote device did have Tasker and you programmed it so that a certain action does something with code. However, you would have to figure out a way to contact that device etc...
27th February 2017, 03:30 PM |#7  
Second update! The Plugin now has Tasker variable support!

(enjoy @MartelKombat btw I'm still thinking about how to implement your other request!)
The Following 3 Users Say Thank You to Humpie For This Useful Post: [ View ] Gift Humpie Ad-Free
1st March 2017, 06:49 AM |#8  
Senior Member
Thanks Meter: 88
 
More
I doont understand. I can type the code, but i do have to remove the "adb sell" part of the code but it's good to go… is that not what this plugin does?
8th May 2017, 12:45 PM |#9  
Senior Member
Flag Berlin
Thanks Meter: 119
 
More
Quote:
Originally Posted by Humpie

Thanks for the tips! Will definitely add variable support and I'll also have a look at output variables. They are visible in the logs already, but not yet to tasker.

Quote:
Originally Posted by Humpie

Second update! The Plugin now has Tasker variable support!

(enjoy @MartelKombat btw I'm still thinking about how to implement your other request!)

Any news on the output variable? I have high hopes since you mentioned you already see the output in the logs...

Thanks a lot for this plugin! It makes an unrooted phone much easier to control!
8th May 2017, 02:03 PM |#10  
Senior Member
Flag Berlin
Thanks Meter: 119
 
More
How to run root commands on an unrooted device with this plugin
I just wanted to share how I use this plugin, just to give others an example of what this nice plugin is capable of.

Recently, I bought a new device and for now, I have no intention of rooting it. Coming from a rooted OnePlus One, this means some of my Tasker profiles do not work as expected anymore and I have to find workarounds.

On LineageOS (and CyanogenMod before that), we have the option to display left/right cursor arrows in the navigation bar when typing text. I always loved this feature, since placing the cursor in the right position by tapping will always be a hit&miss game. Since my new device (S7 Edge) has no onscreen navigation bar, I was searching for a replacement solution to move the cursor. I came up with the idea that it would be quite handy to use the volume buttons for this. So, the idea was the following:

IF the keyboard is shown THEN use the volume keys to move the cursor (and suppress any volume changes, if possible).

It took me a while to figure out how to determine whether the keyboard is out (solution: install another keyboard and intercept the "change input method" notification as a trigger). Suppressing the volume keys' usual behaviour was easy (AutoInput -> Key Suppress) but the final step turned out to be quite difficult: How to move the cursor?

After doing some extensive research, I always came to the same point: "not possible without root". Damn.

But then, this plugin came in. The keyword "remote" in its name might suggest that you can use this plugin only to act from one device to another, but that's not true. Actually, you can use this plugin to run adb commands on the same device.

What does that mean? It means that you can run an adb shell command like "adb shell input keyevent xy" on your phone WITHOUT ROOT. In my case, I can run "input keyevent 21" and "input keyevent 22" to move the cursor. So, how can we do that?

Prerequisites:
Connect your device via ADB to a PC (google it if you don't know how) and run the command "adb tcpip 5555". That's it, you can disconnect your device now.

Then in Tasker, create an action with this plugin and type in the following:

IP Address: localhost
Port: 5555
ADB Shell Command: input keyevent POWER

Hit the play button to test this action. If you've done everything right, your screen will turn off.
Congrats, you just executed a command on an unrooted device which usually requires root privileges!

Important:
The only downside is, the tcpip setting does not survive a reboot, so you have to set the port 5555 again via PC after rebooting the device.

I hope I explained the important part well enough. If that's not the case, don't hesitate to quote me and I'll answer here.
The Following 9 Users Say Thank You to digitalpig82 For This Useful Post: [ View ] Gift digitalpig82 Ad-Free
8th May 2017, 03:02 PM |#11  
Quote:
Originally Posted by digitalpig82

Any news on the output variable? I have high hopes since you mentioned you already see the output in the logs...

Thanks a lot for this plugin! It makes an unrooted phone much easier to control!

I'm sorry for my absence, really busy with school etc. (honestly, I also completely forgot, I hope you can forgive me). I'll try to look into it soon (this week or the next) and see how far I get. I really like that you like my plugin! I just found out myself last week that I can let unrooted phones send shell commands to themselves using my plugin, so I'm glad to see you found it out as well! (I used it for snapchat to simulate volume key presses, which is also possible without root indeed: https://www.reddit.com/r/tasker/comm...t_picture_and/ It also works for other camera apps that require you to hold the button to film, like whatsapp etc)
Edit: I hope it pleases you to hear that today I started working on it again. I already have the responses bundled in a list in Java, now I just need to parse them to Tasker
The Following 2 Users Say Thank You to Humpie For This Useful Post: [ View ] Gift Humpie Ad-Free
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes