Using Shizuku run adb in Macrodroid

LF0

Member
(For more information on how to install and enable Shizuku, please search for other posts, this post only contains how to use it in Macrodrid)


First, follow the "Use in terminal app" tutorial on the Shizuku homepage
IMG_20240123_140556.jpg

Edit the rish file and change the "PKG" in it to "com.arlosoft.macrodroid"

Make sure macrodroid has access to the folder where the rish and rish_shizuku.dex are located

Now you can run ADB with shizuku permissions in a shell script action in macrodroid
(Don't choose to Use Helper App)

The format that is filled in the shell script action is as follows:
sh rish file location -c "adb"
(Examples:
sh /storage/emulated/0/MacroDroid/rish -c "adb reboot")

When you run this action for the first time in macrodroid, Shizuku will pop up a permission request window

But there is one more question
MacroDroid can't get the output value when use shizuku runs adb

Solution(s):
Edit the rish file again, adding a space and the & character at the end of the last line of code

And add these on a new line:
wait $!
ret=${?#0}
echo "${ret%0}"
IMG_20240123_135127.jpg

Now that macrodroid can get the output value normally, you can choose to save it to the specified string variable in the shell script action

As a little trick, you can create an action block like this, so that you can easily use shizuku in other macros
Screenshot_20240122_210319.jpg

This may help some people in need, and any doubts about this are welcome to be discuss
 

Dimlos

Well-known member
The command svc wifi disable is executed but chmod failed:ENOENT is output.
Is there a solution?
 
Last edited:

LF0

Member
Is there a solution?
It doesn't have an effect on adb, you can filter the hint using regex matching, and the solution I know of is to lower the version of shizuku, which appeared after a shizuku update
 
Top