Commands list for shell action:

Jacob L

Moderator (Lawsonator)
Shell script action is compatible with ADB commands, BASH commands and Curl (dependant on device)


run command:
date --version

To find out the version of Toybox.

For other commands and how to use shell action:

To do more, you may need ADB hack which is demonstrated here:

For guides on rooting Android to achieve even more: https://www.xda-developers.com/root
 
Last edited:

FrameXX

Well-known member
What are the coolest things I can do with toybox commands? It seems as a really advanced set of commands.
 

Jacob L

Moderator (Lawsonator)
What are the coolest things I can do with toybox commands? It seems as a really advanced set of commands.
The shell script action is compatible with ADB commands as well so you get to do loads of stuff.

More if you are rooted however, there's lots for non root.

I use shell for cleaning up my system and setting up new devices as well as toggling data saver. Some examples are below.








 

FrameXX

Well-known member
When I follow those links, I'm being taken to a strange website. Again. What's going on?
You are talking about MacroDroid links? You need to open them in MacroDroid. In browser it will show just empty page (or page with Ads). Or just write id on the end of the link in MacroDroid store.
 
Last edited:

janbenes

New member
Hello. On non-rooted device, when I test shell script by "Test Action", it runs well (rm and cp commands). But when ran as automation triggered by button, it seems to me that it runs script under different user and fails on permission problem. When I used shell script to trigger intent, it only ran after I added --user '0'. Is there a possibility to run shell script as user '0' as a whole? Or how I can ensure that shell script can access general storage, not only macrodroid folder?
 

IhtshamUlhuq

New member
I don't understand your question clearly.
But what I understood is this:
Shell script wasn't running for you until you added zero!
/storage/emulated/0/
(talking about zero in the end)..

If yes then, this is how shell script works (you have to add 0 to access general storage)...
But there's a workaround:
In order to access general storage only (not the MD folder; you can use
/storage/emulated/0/
Or
/sdcard/
It'll also access your general or system storage...
 

looplooploop

New member
Hi guys!

Really want to get a way to uninstall apps by some triggers on my unrooted device (which can't be rooted at the moment, already checked XDA forum).

`pm uninstall --user 0 PACKAGE_NAME` uninstalls an app via ADB on my PC but it's not working when I put it in Macrodroid shell script. So I guess it's a no-go for unrooted device.

I'm eager to know any possible ways to achieve this even not by using Macrodroid. Please HELP!

Thanks in advance.
 

Jacob L

Moderator (Lawsonator)
Hi guys!

Really want to get a way to uninstall apps by some triggers on my unrooted device (which can't be rooted at the moment, already checked XDA forum).

`pm uninstall --user 0 PACKAGE_NAME` uninstalls an app via ADB on my PC but it's not working when I put it in Macrodroid shell script. So I guess it's a no-go for unrooted device.

I'm eager to know any possible ways to achieve this even not by using Macrodroid. Please HELP!

Thanks in advance.
If you can get termux working then you can use the termux:Tasker plugin, which can be invoked from MacroDroid
 

looplooploop

New member
If you can get termux working then you can use the termux:Tasker plugin, which can be invoked from MacroDroid
Bad news: pm command is not usable on Android 10 with Termux, see: https://github.com/termux/termux-api/issues/354.

I forgot to mention that I'm on Android 10 & apps I want to uninstall are not system apps.

Now I am stuck in uninstalling a non-system app solely with Termux.

If with Termux is not possible then can mocking UI interaction achieve uninstalling? Or any other ways?
 

Endercraft

Moderator (& bug finder :D)
If with Termux is not possible then can mocking UI interaction achieve uninstalling? Or any other ways?
Of course you can uninstall, but you have to call a prompt so device must be unlocked.
With the send intent action :
Code:
action : android.intent.action.UNINSTALL_PACKAGE
data URI : [the package of the app you want to uninstall]
then you can use UI Interaction to click OK.
 

looplooploop

New member
Of course you can uninstall, but you have to call a prompt so device must be unlocked.
With the send intent action :
Code:
action : android.intent.action.UNINSTALL_PACKAGE
data URI : [the package of the app you want to uninstall]
then you can use UI Interaction to click OK.
What I've configured in Actions was:
Send Intent
Target - Activity (and I've tried Broadcast/Service, none of them working)
Action - android.intent.action.UNINSTALL_PACKAGE
Data - tv.telepathic.hooked

Test actions, then MacroDroid warned:
Send Intent Failed
No Activity found to handle Intent
{ act=android.intent.action.UNINSTALL_PACKAGE dat=tv.telepathic.hooked flg=0x10000000 }

I can't call out the uninstall prompt. Could you shed some light on where I've done wrong?
 

FrameXX

Well-known member
What I've configured in Actions was:
Send Intent
Target - Activity (and I've tried Broadcast/Service, none of them working)
Action - android.intent.action.UNINSTALL_PACKAGE
Data - tv.telepathic.hooked

Test actions, then MacroDroid warned:
Send Intent Failed
No Activity found to handle Intent
{ act=android.intent.action.UNINSTALL_PACKAGE dat=tv.telepathic.hooked flg=0x10000000 }

I can't call out the uninstall prompt. Could you shed some light on where I've done wrong?

You need to write package: before the package. Like so:

action: android.intent.action.UNINSTALL_PACKAGE
data: package:com.app.package

Use Activity as a target.
 

Endercraft

Moderator (& bug finder :D)
You need to write package: before the package. Like so:

action: android.intent.action.UNINSTALL_PACKAGE
data: package:com.app.package

Use Activity as a target.
Yes, I felt like I had forgotten something but couldn't remember what.
 

looplooploop

New member
You need to write package: before the package. Like so:

action: android.intent.action.UNINSTALL_PACKAGE
data: package:com.app.package

Use Activity as a target.
Bravo! Thanks you guys. The uninstall prompt now coming in.

After some tests I got another question on mind. There must be enough time between Send Uninstall Intent and UI Click OK, right?

- When no Wait time between, the APP can't be uninstalled.
- When there is Wait 10 ms, still can't be uninstalled. Seems the interval is too short.
- When there is Wait 1 s, the APP successfully uninstalled.

Is there any other way to make sure we have an OK for UI Interaction to Click OK instead of guessing the interval (setting a Wait time x between)? Bc you know the interval could be a little longer when the device is busy running other things. If it's possible, I want to achieve a 100% surely&quickly uninstall.
 

Endercraft

Moderator (& bug finder :D)
Bravo! Thanks you guys. The uninstall prompt now coming in.

After some tests I got another question on mind. There must be enough time between Send Uninstall Intent and UI Click OK, right?

- When no Wait time between, the APP can't be uninstalled.
- When there is Wait 10 ms, still can't be uninstalled. Seems the interval is too short.
- When there is Wait 1 s, the APP successfully uninstalled.

Is there any other way to make sure we have an OK for UI Interaction to Click OK instead of guessing the interval (setting a Wait time x between)? Bc you know the interval could be a little longer when the device is busy running other things. If it's possible, I want to achieve a 100% surely&quickly uninstall.
Well, you could use a wait for trigger with 'Do you want to uninstall this app ?', combined with a regular interval of 10 seconds (no reference time) in case something goes wrong.
 
Top