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/details?id=com.ADBPlugin
Edit: It's now also available on XDA Labs! You can find it here
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.
@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.
MartelKombat said:
@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.
Click to expand...
Click to collapse
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.
Why can't we use the built-in code Acton in Tasker? Is there a difference?
loogielv said:
Why can't we use the built-in code Acton in Tasker? Is there a difference?
Click to expand...
Click to collapse
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...
Second update! The Plugin now has Tasker variable support!
(enjoy @MartelKombat btw I'm still thinking about how to implement your other request!)
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?
Humpie said:
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.
Click to expand...
Click to collapse
Humpie said:
Second update! The Plugin now has Tasker variable support!
(enjoy @MartelKombat btw I'm still thinking about how to implement your other request!)
Click to expand...
Click to collapse
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!
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.
digitalpig82 said:
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!
Click to expand...
Click to collapse
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/comments/699sav/project_share_handsfree_snapchat_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
loogielv said:
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?
Click to expand...
Click to collapse
Yes, you have to remove the "adb shell" part since all my plugin does is access the adb shell part. This means commands like adb pull etc won't work, that requires a different type of connection, that for now I can't achieve with Tasker. But running any remote shell command should be fine (like how you would run it if you were directly running the commands from a terminal on your phone)
digitalpig82 said:
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.
Click to expand...
Click to collapse
So...is it possible to create a version of the plugin that runs locally and doesn't disappear on a reboot?
kenkiller said:
So...is it possible to create a version of the plugin that runs locally and doesn't disappear on a reboot?
Click to expand...
Click to collapse
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.
However what I would advise to do if this option is not available, is to create a .bat file on your desktop containing "adb tcpip 5555". That way after a reboot you can just plug in your phone, click the bat file and be done!
Humpie said:
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.
However what I would advise to do if this option is not available, is to create a .bat file on your desktop containing "adb tcpip 5555". That way after a reboot you can just plug in your phone, click the bat file and be done!
Click to expand...
Click to collapse
Hmm....But there's this custom nav bar app where it allows users to grant it adb shell permissions, and the permission survives over reboots. Auto tools and Securetask relies on the same process as well.
I guess what we're asking for is something that's not as encompassing as your plugin. Me, I just want to execute the power command without root in a way that respects smart lock, which is possible now with your app but doesn't survive a reboot, or with the custom nav bar app, which survives a reboot, but restricts me to using it in a tiny button on the nav bar, as the dev doesn't seem interested in exposing the commands to external usage.
---------- Post added at 07:30 AM ---------- Previous post was at 07:28 AM ----------
We discussed it in this part here....
https://forum.xda-developers.com/an...avigation-bar-customize-t3590967/post72212488
kenkiller said:
Hmm....But there's this custom nav bar app where it allows users to grant it adb shell permissions, and the permission survives over reboots. Auto tools and Securetask relies on the same process as well.
I guess what we're asking for is something that's not as encompassing as your plugin. Me, I just want to execute the power command without root in a way that respects smart lock, which is possible now with your app but doesn't survive a reboot, or with the custom nav bar app, which survives a reboot, but restricts me to using it in a tiny button on the nav bar, as the dev doesn't seem interested in exposing the commands to external usage.
---------- Post added at 07:30 AM ---------- Previous post was at 07:28 AM ----------
We discussed it in this part here....
https://forum.xda-developers.com/an...avigation-bar-customize-t3590967/post72212488
Click to expand...
Click to collapse
It seems this app uses specific android permissions to be able to send events etc. However my plugin has no direct access to the android system (only by using the adb bridge), so granting my plugin these permissions won't help. What however would help is if I could find a way to enable adb over wifi using only some permissions... I have no clue whether this is possible though as the app would have to call service.adb.tcp.port 5555 for itself and that needs root or an adb connection (so it still requires a laptop XD). I'm still trying though.
Humpie said:
It seems this app uses specific android permissions to be able to send events etc. However my plugin has no direct access to the android system (only by using the adb bridge), so granting my plugin these permissions won't help. What however would help is if I could find a way to enable adb over wifi using only some permissions... I have no clue whether this is possible though as the app would have to call service.adb.tcp.port 5555 for itself and that needs root or an adb connection (so it still requires a laptop XD). I'm still trying though.
Click to expand...
Click to collapse
No worries. It's just that it's so close yet so far, heheh.... I guess I'll have to reboot only when home.
kenkiller said:
No worries. It's just that it's so close yet so far, heheh.... I guess I'll have to reboot only when home.
Click to expand...
Click to collapse
I found out it is in fact possible to have wireless adb survive a reboot! However it requires a build.prop edit.
in \system\build.prop "service.adb.tcp.port=5555" needs to be added at the end of the file and then after a reboot adb over wifi will still be enabled (at least it was in my case).
The downside is that this modification can't be done via adb without root unless you have a custom recovery like TWRP and run adb while having that opened and /System/ mounted.
I'm trying to create a zip that modifies the build.prop how it should be modified, but I don't think it's possible to run it through a non-custom recovery...
Edit: I added my .bat file for modifying the build.prop adding that line. It uses an adb connection that requires more rights than what android allows when booted, but should probably work if you are able to access adb from recovery and you are of course booted in recovery mode (using recoveries like TWRP or even some stock manufacturer ones).
Update 4.3 is live!
As requested you can now access the output from the console directly in Tasker.
I tried to order everything neatly in a list, with each line in the console being an item in the list, but this does mean that the initial "device\sdcard $" et cetera get added as an item as well.
But since I didn't want to cut off anything important I just kept it that way. You can just modify the list in any way you want (AutoTools has some handy Array handling tools built in).
I also added some hints in the main screen just for fun.
If you run into any strange behaviour, bugs or have tips, please tell me!
digitalpig82 said:
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!
Click to expand...
Click to collapse
Enjoy
Since most people are using my Plugin locally instead of remotely, I'm thinking of renaming it to just 'ADB Shell [Tasker]'. It would make it simpler when googling it. What do you think?
I am sure many of us are playing Fire Emblem Heroes. Every time I load the game I keep getting an Error 803-3001. A temporary fix that I found so far is just manually delete a file: data/data/com.nintendo/zaba/shared_prefs/deviceAccount:.xml and then relink my account Error 3
I am quite new to tasker and starting to explore it more. I found that I can create a widget short that would launch apps and more. It looks like one option is set commands through secure settings. I assume I can set a command to delete that xml file and then have it launch the game. I don't know how to quite do this and thus
I did notice that Tasker has a delete file function but I don't think it work for root.
I am hoping to get some help on how to do this, so I don't brick my device.
I'm pretty much a Tasker n00b, but I imagine you'd want something along the lines of:
code action ---> run shell
command 'rm /data/data/com.nintendo/zaba/shared_prefs/deviceAccount.xml' with 'use root' checked
maybe add a wait action like 1 second or something, and then the launch app action and make a widget.
I think...that's off my head and I don't have my phone with me.
Andromeda_Station said:
I'm pretty much a Tasker n00b, but I imagine you'd want something along the lines of:
code action ---> run shell
command 'rm /data/data/com.nintendo/zaba/shared_prefs/deviceAccount.xml' with 'use root' checked
maybe add a wait action like 1 second or something, and then the launch app action and make a widget.
I think...that's off my head and I don't have my phone with me.
Click to expand...
Click to collapse
Yeah I tried that and got error 255. See attached screenshot.
I also read somewhere there may be permission issues with the file. I did try to set the permission of the file first (I know you can do it in tasker, but I did it manually, where chmod=777).
Huh...not a real helpful error lol.
Might be worth installing a terminal emulator and doing the command through that and see what happens? Maybe get a more informative error. I wonder, if maybe the 'su' command needs to be issued first even though 'use root' is checked.
Andromeda_Station said:
Huh...not a real helpful error lol.
Might be worth installing a terminal emulator and doing the command through that and see what happens? Maybe get a more informative error. I wonder, if maybe the 'su' command needs to be issued first even though 'use root' is checked.
Click to expand...
Click to collapse
i did a stupid coding errror...
So the post states data/data/com.nintendo/zaba/shared_prefs/deviceAccount:.xml
I copied and pasted this path from the URL posted. when trying it the first time.. I couldn't much info on the error from the screenshot.
So I took your advice and downloaded a terminal emulator... the one I used didn't let me copy and paste so I typed out the wrong path from the URL posted.. and it gave me a "file not found" error...
When checking solid explorer, it is actually /com.nintendo.zaba.. now it works with the initial tasker shell.
Thanks for all your help.
Now only if I can instead make a widget tasker shortcut, make an icon within my app drawer for this "batch" file.
Ah, nice
I've never tried this, but I remember reading if you create the tasks/profile in their own project it can be exported as an apk.
edit: here's what I saw I think:
https://www.reddit.com/r/tasker/comments/1pi6nd/how_do_i_create_an_app_from_a_profile/
Andromeda_Station said:
Ah, nice
I've never tried this, but I remember reading if you create the tasks/profile in their own project it can be exported as an apk.
edit: here's what I saw I think:
https://www.reddit.com/r/tasker/comments/1pi6nd/how_do_i_create_an_app_from_a_profile/
Click to expand...
Click to collapse
Thanks! I will look into it.
so basically i want to monitor system wide app installation and uninstallation, including sideloading with dates? if possible to have it create a log and store it in a specific folder that is locked or can't be accessed or deleted without code. and to do a daily or weekly check to see if any changes were made.
also is there a task to block all installations including sideloading?
any help would be appreciated.
@ktmom
So tracking installed and uninstalled apps is straightforward.
I'm not aware of a way to lock the resulting file per se. Encrypt it, probably. But to prevent any other app from accessing it, I don't know how to do that. It could be uploaded to the cloud, e.g. Google drive. Then the local copy deleted. That's kinda fussy. Saving it as a variable array is doable, then Tasker can be locked.
If on every install / uninstall, the log is updated, why does there need to be a daily/weekly check?
I would have to test and see if the package manager can be "locked".
Is the device in question rooted?
This kinda sounds like something I might do to my kids phone [emoji6]. If this is actually the case, the file could be sent to your device or email on update. It wouldn't matter if the local copy was edited. You also could know immediately if an app had changed.
I asked in the other thread, do you have any familiarity with tasker?
@ktmom
device is non rooted,
file sent to email would be fine if that will get rid of daily/weekly checks. (<--- this was just something I wanted that maybe i'll just use in notepad++ to highlight the differences for a quick way of seeing changes.)
i have dabbled in tasker many years ago, only to enable/disable wifi and turn on vpn in geo fenced locations.
I haven't forgotten you. I should post a solution by the weekend. I'm just spending some time to make sure the kinks are out. You will need the MailTask plugin. I personally use a script in termux (requires cURL) to send via Google servers, but that is harder to setup, particularly with OATH. The plugin makes life much easier.
ktmom said:
I haven't forgotten you. I should post a solution by the weekend. I'm just spending some time to make sure the kinks are out. You will need the MailTask plugin. I personally use a script in termux (requires cURL) to send via Google servers, but that is harder to setup, particularly with OATH. The plugin makes life much easier.
Click to expand...
Click to collapse
ok great, thank you!
@BobMcGeez
Finally, I think I have this stable and able to handle multiple consecutive app installations and removals. I am working under the assumption that the use for this project is to monitor possible dangerous activity on a child’s device. I do not condone the use of this for monitoring a device without adult consent.
This project will send an email notification when a new app is installed or an existing app is removed. The email will include a CSV file with the remaining still installed apps. It should ignore apps that are being updated (they remove then install). The emails are sent silently and there should not be any indication to the user this is happening in the background. The CSV file is saved in the {storage}/Tasker/tasks/ directory. Each time an email is sent, the stored file is also updated. One instance of the previous file is saved as well.
First, you need MailTask installed. Please ensure that the MailTask plugin is fully configured and tested before installing this project. We are using OAuth Gmail authentication, so ignore SMTP stuffs.
Also, IMHO, I would use a GMail account maybe even created for this purpose, but at least one not setup to routinely access by the device user. This way, the user’s account will not reflect the sent messages.
To configure and test MailTask
Open MailTask from the app drawer on your device
Perform “Authorize Gmail Access” Use the account for the “from” you want to use in this project
Perform “Grant access to primary storage”
If your device has an SDcard, perform “Grant access to Sd card”
Now if you want, you can create a task in your Tasker installation to test the MailTask plugin
Create a test task
Add a MailTask action (Plugin -> MailTask -. send email)
Configuration:
From = Account used to Authorize Gmail Access above
To = Account where to send email
Subject = Testing MailTask
Body = Some text to take up space
Attachments = choose a basic file using the paperclip icon just for there to be an attachment
Test plugin by manually running the task.
If all is good, you can delete this test
Now install the project (taskernet link). On install, accept enabling the profiles. If you do, then the Installation task should run automatically. If you prefer not to, or if you need to re-run the installation, manually run the “Initial Setup” task.
This project may be shared under GNU v2. You may share, modify and use it provide you don't charge, the code is open and credit is provided.
Does anyone know if it is possible to have an onscreen keyboard on the bottom screen (ie the phone) when using the Twinview Dock 3? For example, if using it to type emails etc, the bottom screen would be the keyboard and the top screen would be the mobile app.
yes, took me a minute to figure out but it can be done
Thanks @biotoxin, might send you a message when the unit arrives for a hand in setting it up if that is ok. Will also post details here for other users.
heads up it's app specific, not broad form, the screens are effectively 2 independent systems, so it's up to each app to make it work
I've been looking at apps like an2an to maybe get something more universal but it seems like the twinview doesn't like multiple instances of the same app simultaneously but I remember there being an option to make it happen so I'm researching...
the twin apps feature might be one way but I'm not entirely sure... details below
Code:
1.Download file twinapps_required_apps.xml
https://gist.github.com/shakalaca/9c7a8c6769cb87c6e7d83e809cbe6e5d#file-twinapps_required_apps-xml
Remember, you must download the file from right corner "Raw" button, do not press "download zip" to download or copy and paste the strings from the link
2.Find out the app package name that you want to add , As the example from the tutorial, they choose "GoShare" as an example, you can check its package name from the website version Google play, the hyperlink after "id=" is its' package name.
For Example "https://play.google.com/store/apps/details?id=com.gogoro.goshare"
"com.gogoro.goshare" is the package name.
3.Edit the downloaded twinapps.xml. Find out this string from the file "<string-array name="twinapps_required_apps">" (for apps)
or <string-array name="twinapps_required_apps_games">(for games). Added <item></item> in the front and after the package name. For example if you want to add "Goshare" in the app list, it should be<item>com.gogoro.goshare</item>. Add it after <item>com.imo.android.imoim|imo free video calls and chat</item>. And Save the file.
4 Connect your phone to your pc and use adb to push the edited twinapps.xml into your phone adb push twinapps.xml /sdcard/.
5 After pushed the xml file to your file, use this command to update the twinapps list
adb shell am startservice -a "asus.intent.action.TWINAPPS_CDN_FILE_UPDATE" -d "file:///sdcard/twinapps.xml" --ei "ACTION" 1 com.asus.twinapps/.TwinAppsService.
@biotoxin - just got the twinview dock 3 - great piece of hardward, well built and the power/volume buttons are handy!
In relation to getting a keyboard working on the lower screen - which apps did you use that it worked on, are you able to share the settings? Thanks!
Basically everything that officially supports it is listed in the armory crate, there's a jank way to do some things but it irritates me on a fundamental level so I'm looking into api level access to see if maybe I can make a wrapper that'll launch anything/ everything, or at least wrap a keyboard, if you want to give it a stab unity has the api info readily available or there's the jank way mentioned above
Hmm definitely can't seem to find a way to launch a keyboard on the bottom screen, how did you manage to do it?
Could someone port something over from the Microsoft duo perhaps? Android is capable of it, would be awesome for so many things!
whatevvz
Hey folks,
I'm having some troubles with my bank app because of root and using magisk hide doesn't solve the problem. So, searching on the internet i found that i could use the app Island (By OasisFeng) to create a work user and would made the app work supposedly.
I was forced to setup the app manually throw adb with their guide in the Manual setup for Island section and now i'm stuck. The phone boots up but when i enter the pin code the phone reboots.
This were the commands i've used:
adb -d shell
pm create-user --profileOf 0 --managed Island
pm path com.oasisfeng.island
pm install -r --user <10> <path(i don't remember but i've entered the path that showed with the command above)>
And i couldn't continue because the command above output an error that wasn't mentioned there.
Can anyone help me with this, please? I'm desperate.
Thanks for help!!
up
This seems specific to an app and not to this phone.
Have you looked here?
[APP][5.0+][BETA] Island - app freezing, privacy protection, parallel accounts
What is "Island" "Island" is a sandbox environment to clone selected apps and isolate them from accessing your personal data outside the sandbox (including call logs, contacts, photos and etc) even if related permissions are granted...
forum.xda-developers.com