I know that this is not where to talk about it, but when restarting the smartphone the settings seem lost. I try to buy LADB but it doesn't work, Google says you need an internet connection, while yet I can download other applications...
I just read your previous replies and you're getting confused on 2 different things.
First of all, you mentioned that you got an exception error when running this:
If I apply the command adb shell pm grant com.arlosoft.macrodroid android.permission.WRITE_SECURE_SETTINGS I have error messages.
I own like 5 different Xiaomi devices and I'm familiar with this error. This is purely due to the fact that you haven't enabled USB Debugging and USB Debugging (Security Options) on your phone. The instructions in the OP is actually not entirely accurate. On your phone, all you need to do is this:
1.1-Enable Developer options (google to find how to do it)
1.2-Enable USB debugging
1.4-Enable USB debugging (Security Options)
1.5.Disable adb authorization timeout
Then, connect your phone to your PC and then run the adb shell command again. You might need to install the ADB driver on your PC, I'm not going to go over this, you can read up the instructions yourself -
https://forum.xda-developers.com/t/...vers-15-seconds-adb-installer-v1-4-3.2588979/
The Macrodroid ADB shell command just needs to be done once. You do NOT need to do this every time your phone reboots.
As for the discussions related to
wireless debugging / Termux / LADB, that is completely separate to the instructions above and it is optional. There are certain MacroDroid features and certain ADB commands that require elevated permissions to run. To get elevated permissions, you either need to ROOT your phone, or you need to run using elevated ADB.
For example, if you want to disable an app using ADB shell command, then it would look something like this:
adb shell pm disable-user --user 0 com.android.randomApp
You can put that into a .sh script and run it using MacroDroid. The problem is that if your phone is not running as ROOT, then you won't be able to run the command above. If you want to run the command while keeping your phone unrooted, then the only other way is to make your phone use elevated ADB. To do this, connect your phone to your PC and run:
Now, you should be able to run pretty much ANY adb shell commands on your phone directly.
But here's another problem. Elevated ADB is only temporary. Whenever you restart your phone, you need to connect to your PC and run "adb tcpip 5555" again. This is where wireless debugging + Termux or LADB comes in. You essentially run "adb tcpip 5555" locally on the phone, without a need of tethering your phone to a PC.
I'm not going to go into this in detail and you can decide if you actually need this or not. My only recommendation is to use Termux, it's free and it's much better than the alternatives. You don't need LADB, it actually sucks in my opinion.
Follow the instructions I posted on how to get this set up for Termux to work with MacroDroid. It's a one-time set up.
tanutanu has already shared the link to the instructions.
Lastly, I recommend you Google or look up guides on XDA to learn about ADB commands, USB debugging and wireless debugging. You're confusing the requirements for wireless ADB, USB Debugging and USB Debugging (Security Options). Familiarize yourself with them first, or else you'll just be asking random questions that don't make sense and confusing yourself even more.