run "pm grant com.google.android.gms android.permission.ACCESS_COARSE_LOCATION". invalid, why?
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.
07-20 19:07:17.730 32401 32648 I com.ADBPlugin: Loaded existing keypair
07-20 19:07:17.730 32401 32648 I com.ADBPlugin: Socket connecting...
07-20 19:07:17.732 32401 32648 I com.ADBPlugin: Socket connected, creating AdbConnection...
07-20 19:07:17.732 32401 32648 D com.ADBPlugin: Created, ADB connecting...
07-20 19:07:17.738 32401 32648 D com.ADBPlugin: ADB connected, opening shell stream...
07-20 19:07:17.746 32401 32648 D com.ADBPlugin: Opened, writing command: pm uninstall --user 0 -k com.whatsapp
07-20 19:07:17.747 32401 32648 D com.ADBPlugin: Command sent, getting responses
07-20 19:07:17.771 29007 29007 D checkDoubleClick: click
07-20 19:07:17.792 32401 32648 D com.ADBPlugin: response: pm uninstall --user 0 -k com.whatsapp
07-20 19:07:17.792 32401 32648 D com.ADBPlugin: response: ^@
07-20 19:07:17.792 32401 32648 D com.ADBPlugin: response: 7[r[999;999H[6n8
07-20 19:07:17.792 32401 32648 D com.ADBPlugin: response: OnePlus3:/ $
07-20 19:07:17.792 32401 32648 D com.ADBPlugin: Sending exit command and waiting for stream to close
07-20 19:07:17.796 32401 32648 W System.err: java.io.IOException: Stream closed
07-20 19:07:17.796 32401 32648 W System.err: at com.cgutman.adblib.AdbStream.read(AdbStream.java:124)
07-20 19:07:17.796 32401 32648 W System.err: at com.ADBPlugin.SendSingleCommand.SendSingleCommand(SendSingleCommand.java:251)
07-20 19:07:17.796 32401 32648 W System.err: at com.ADBPlugin.receiver.FireReceiver$1.run(FireReceiver.java:89)
07-20 19:07:17.796 32401 32648 W System.err: at java.lang.Thread.run(Thread.java:761)
07-20 19:07:17.796 32401 32648 D com.ADBPlugin: Stream closed, closing Adb...
07-20 19:07:17.796 32401 32648 D com.ADBPlugin: ADB Closed
07-20 19:07:17.796 32401 32648 D com.ADBPlugin: Executed single command
This doesn't work outside my Plugin either. I'm not sure what you're trying to do
I've enabled wireless ADB on phone.
then, I connected my phone to PC, ran "adb tcpip 5555", opened tasker, tried to use the addon, BUT NO COMMAND whatsoever works.
( tried localhost, 5555, and commands:
A. "input keyevent POWER"
B. "pm uninstall -k --user 0 PACKAGE_NAME"
)
I use Tasker v5.0b9 on android 7.1.2 ( WITH root... so that's weird... I would expect it not to work on non-rooted phone... by mine is rooted, although the addon does not request any root perm ).
@Humpie - can you please check this addon on nougat with latest tasker ?
P.S - I guess the relevant logcat is:
---------- Post added at 04:46 PM ---------- Previous post was at 04:30 PM ----------
"pm" command can only work through ADB without root perm on phone.
if you tried running it using terminal emulator ( again, without any root ), it won't work.
try connecting to a PC, open ADB then run it -> it will probably work.
I've enabled wireless ADB on phone.
then, I connected my phone to PC, ran "adb tcpip 5555", opened tasker, tried to use the addon, BUT NO COMMAND whatsoever works.
( tried localhost, 5555, and commands:
A. "input keyevent POWER"
(...)
But actually, since you're rooted, it seems kind of pointless to use this plugin instead of just using the shell with root enabled...
I can enter "adb shell" on PC without problem, using either USB or wireless ADB.After you connected your device to the pc, did you type "adb devices" at first to make sure you've got a connection to the device? Did you get any console output when you were typing the commands from the pc? Any additional info will help.
I stated i'm rooted to clarify that it doesn't work.
I do want to run in on devices without root though... what's why i'm interested in that plugin
I can enter "adb shell" on PC without problem, using either USB or wireless ADB.
I do get "approve this device" and I select approve.
I can run "adb devices" and get my device info ON A PC, without problem.
Nontheless, any adb shell command ("ls -ls", "pwd", the command in my last post) I run using the plugin, I get %output that repeats my command with another "$" empty line after it.
I also made sure that appOps gave the plugin ALL the permissions and that my firewall (afwall) is disabled.
I stated i'm rooted to clarify that it doesn't work.
I do want to run in on devices without root though... what's why i'm interested in that plugin
I can enter "adb shell" on PC without problem, using either USB or wireless ADB.
I do get "approve this device" and I select approve.
I can run "adb devices" and get my device info ON A PC, without problem.
Nontheless, any adb shell command ("ls -ls", "pwd", the command in my last post) I run using the plugin, I get %output that repeats my command with another "$" empty line after it.
I also made sure that appOps gave the plugin ALL the permissions and that my firewall (afwall) is disabled.
Hi @Humpie - thanks for the reply.If you get that as output, it means the command you executed worked. Just like when you would type it from a console. I think the problem thus is somewhere else. My Plugin uses the same adb library as the following (free) app https://play.google.com/store/apps/details?id=com.cgutman.androidremotedebugger. It's the same code as my Plugin uses, just without Tasker support. Can you try if it works with this app?
Hi @Humpie - thanks for the reply.
using the app you linked, I can indeed send to "localhost:5555" commands, and they exec and work just fine.
that is indeed weird...
I do the same with your tasker plugin, but the commands I send simply do not work.
I attack screenvideo that shows that
I'll investigate after my holiday, but I still find it strange since it does work with that other app and I have the same code. The only difference is the Tasker part and I just followed their official guidelines and templates for that.
I'll investigate after my holiday, but I still find it strange since it does work with that other app and I have the same code. The only difference is the Tasker part and I just followed their official guidelines and templates for that.
In my case, the command sent to the localhost can only be excuted once.
For example, after the first use of: input keyevent POWER. The phone went into sleep. Unlock and run again, it got time out error.
The only way to make it work again is to toggle the USB Debugging.
I've had this problem in the very beginning of building the plugin, but the problem disappeared after the command was executed. It's like there can only be a single instance of the Plugin running (which seems reasonable since the receiver can only have one adb device connected to it) and sometimes when Tasker sends an intent to the plugin it takes ages for it to arrive, so this (or for this reason receiving multiple intents) causes the running plugin to not properly end the previous connection and then thus block the connection from all others on the receiving device.
I'd have to look into if I can detect from the plugin that the connection needs to be closed whether or not the command was executed because another command needs to be sent... But this will be hard for me
True, it has to be a problem of multiple instances. I had tried to add "exit" after each command. But it seems it is not something can be done with the current plugin.
Hope you can find a way around it. It is a very useful plugin. Cheers.
Well first I need to be able to recreate the problem as it doesn't occur for me. If I find it, then I'll have to look for a way to rebuild the entire app I guess.. So it will probably take a while. I'm sorry.
I've had this problem in the very beginning of building the plugin, but the problem disappeared after the command was executed. It's like there can only be a single instance of the Plugin running (which seems reasonable since the receiver can only have one adb device connected to it) and sometimes when Tasker sends an intent to the plugin it takes ages for it to arrive, so this (or for this reason receiving multiple intents) causes the running plugin to not properly end the previous connection and then thus block the connection from all others on the receiving device.
I'd have to look into if I can detect from the plugin that the connection needs to be closed whether or not the command was executed because another command needs to be sent... But this will be hard for me
I've enabled wireless ADB on phone.
then, I connected my phone to PC, ran "adb tcpip 5555", opened tasker, tried to use the addon, BUT NO COMMAND whatsoever works.
( tried localhost, 5555, and commands:
A. "input keyevent POWER"
B. "pm uninstall -k --user 0 PACKAGE_NAME"
)
I use Tasker v5.0b9 on android 7.1.2 ( WITH root... so that's weird... I would expect it not to work on non-rooted phone... by mine is rooted, although the addon does not request any root perm ).
@Humpie - can you please check this addon on nougat with latest tasker ?
P.S - I guess the relevant logcat is:
---------- Post added at 04:46 PM ---------- Previous post was at 04:30 PM ----------Code:07-20 19:07:17.730 32401 32648 I com.ADBPlugin: Loaded existing keypair 07-20 19:07:17.730 32401 32648 I com.ADBPlugin: Socket connecting... 07-20 19:07:17.732 32401 32648 I com.ADBPlugin: Socket connected, creating AdbConnection... 07-20 19:07:17.732 32401 32648 D com.ADBPlugin: Created, ADB connecting... 07-20 19:07:17.738 32401 32648 D com.ADBPlugin: ADB connected, opening shell stream... 07-20 19:07:17.746 32401 32648 D com.ADBPlugin: Opened, writing command: pm uninstall --user 0 -k com.whatsapp 07-20 19:07:17.747 32401 32648 D com.ADBPlugin: Command sent, getting responses 07-20 19:07:17.771 29007 29007 D checkDoubleClick: click 07-20 19:07:17.792 32401 32648 D com.ADBPlugin: response: pm uninstall --user 0 -k com.whatsapp 07-20 19:07:17.792 32401 32648 D com.ADBPlugin: response: ^@ 07-20 19:07:17.792 32401 32648 D com.ADBPlugin: response: 7[r[999;999H[6n8 07-20 19:07:17.792 32401 32648 D com.ADBPlugin: response: OnePlus3:/ $ 07-20 19:07:17.792 32401 32648 D com.ADBPlugin: Sending exit command and waiting for stream to close 07-20 19:07:17.796 32401 32648 W System.err: java.io.IOException: Stream closed 07-20 19:07:17.796 32401 32648 W System.err: at com.cgutman.adblib.AdbStream.read(AdbStream.java:124) 07-20 19:07:17.796 32401 32648 W System.err: at com.ADBPlugin.SendSingleCommand.SendSingleCommand(SendSingleCommand.java:251) 07-20 19:07:17.796 32401 32648 W System.err: at com.ADBPlugin.receiver.FireReceiver$1.run(FireReceiver.java:89) 07-20 19:07:17.796 32401 32648 W System.err: at java.lang.Thread.run(Thread.java:761) 07-20 19:07:17.796 32401 32648 D com.ADBPlugin: Stream closed, closing Adb... 07-20 19:07:17.796 32401 32648 D com.ADBPlugin: ADB Closed 07-20 19:07:17.796 32401 32648 D com.ADBPlugin: Executed single command
.
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 would like to be able to create such a think but I don't think Google would allow it since it's a big security flaw to have adb opened to the world at all time without notifying the user. Some devices however have a debug over wifi function hidden in the developer options (like the nvidia shield android tv), there you can just enable it and it will probably survive a reboot.So...is it possible to create a version of the plugin that runs locally and doesn't disappear on a reboot?