Setup MacroDroid on Xiaomi: the complete guide

Owners of Xiaomi smartphones with MIUI or HyperOS shells often face aggressive memory management systems that ruthlessly kill background processes. This poses serious problems for automation applications such as MacroDroid, whose main function is to constantly monitor triggers and perform actions. Without the right configuration, your macros will simply stop working after the screen is turned off, which negates the whole point of using the tool.

Getting MacroDroid right on Xiaomi devices requires not only installing the app itself, but also deep integration into system permissions. You’ll have to go through multiple layers of the security menu to “explain” to the system that this particular application needs to be allowed more than others.

In this guide, we will take a detailed look at all the steps you need to make your app work smoothly. We will look at battery settings, special permissions, working with triggers, and creating useful macros that are tailored specifically to the Xiaomi ecosystem. Following the instructions, you will turn your smartphone into a truly smart device.

Installation and primary preparation of MacroDroid

The first step is to download the current version of the app from the official Google Play store or Huawei AppGallery. Once installed, take your time to launch the program right away; the first priority is to provide the basic rights that Android will request. Without them, MacroDroid will not even be able to display the interface or save the first macro.

When you first run the app, it will ask permission to access storage, microphone and geo-location. It is critical for Xiaomi users to immediately allow access to all the requested features, even if you do not plan to use them yet. Later, the system can block a repeat request, and you will have to search for the desired permission deep in the settings.

⚠️ Warning: New versions of HyperOS may have a pop-up warning of “security risks” on their first launch, a standard response of Xiaomi’s defenses to apps that request broad rights. Choose “Continue” or “Still Start” as MacroDroid is a proven tool.

Next, you need to activate the special features service, which is a key component that allows the application to emulate the clicks on the screen and read the contents of the interface. Unlike other brands, Xiaomi may need additional confirmation through a pin code or fingerprint after the service is turned on.

Setting up energy saving and work in the background

The most common reason for malfunctioning macros on Xiaomi is aggressive power saving mode. The default system limits the background activity of applications to save charge, which is fatal for MacroDroid. You need to manually change the application strategy to "No Limits".

To do this, go to Settings → Applications → All apps. Find MacroDroid in the list and click on Battery Savings. The default is “Recommended Charge Savings.” You need to switch this setting to No Limits, which will allow the application to work even when the screen is off.

📊 Have you ever experienced a “killing” of background apps on the MIUI?
Yeah, all the time.
Sometimes.
Never noticed.
Using a different brand.

Also, check the settings in the Security section (green app with lightning). Go to Battery → Settings (cogs) → Autostart applications. Make sure the slider opposite MacroDroid is activated. This will allow the application to start immediately after the phone is restarted without you.

You can lock the app in memory. Open the list of running apps (swipe from the bottom up and hold or menu button), find the MacroDroid window and pull it down. The lock icon should appear on the right, which is a signal to the system that the application should not be closed when you clear the memory with the Crest button.

Special permissions and access to data

In addition to basic rights, MacroDroid requires access to a number of specific system features to implement complex scenarios. On Xiaomi smartphones, these permissions are often hidden in the depth of the menu or require manual activation via ADB, although the latest versions of MIUI 14 and HyperOS have improved.

Be sure to check the Special Options section of the app settings. Here you need to activate access to usage history (for application launch triggers), access to notifications (to respond to messages), and the ability to draw over other windows. Without the last item, macros that change volume or brightness may not work if another application is open at that moment.

☑️ Checklist of MacroDroid Permits

Done: 0 / 5

If your macros are supposed to work with files (for example, creating logs or saving screenshots), Xiaomi can block access to the folder. Android/data. In this case, the first time you access the file, the system will show a strong warning, and you will need to click "Allow" and confirm the action, possibly using the system file manager.

Dealing with MIUI Triggers and Limitations

Triggers are events that trigger macros. On Xiaomi, some triggers work with specifics. For example, the Wi-Fi Status trigger can be triggered with a delay if the system decides that scanning networks in the background is overly resource-consuming. To minimize delays, it is recommended to use triggers tied to system events, rather than a status survey.

The triggers associated with NFC and Bluetooth require constant active operation of the respective modules. If you use a macro to distribute the Internet or turn on a Bluetooth headset, make sure that the Bluetooth settings include the option “Visibility” or similar, preventing the adapter from going to sleep too quickly.

There is a nuance with triggers responding to incoming calls or SMS. On some Xiaomi regional firmware (especially the Chinese versions, CN ROM), access to the call log and SMS is limited. In such cases, MacroDroid may not see the incoming event. The solution is to use alternative triggers, for example, through notifications from messengers, if standard SMS are not tracked.

⚠️ Note: Triggers that use geolocation (GPS), Xiaomi recommends settings in the location to select the mode "Device only» (GPS) or “High accuracy”, but for MacroDroid it is better to set the resolution “Always”, otherwise, when folded, the coordinates will not be updated.

Creating useful macros for Xiaomi

Once the rights are set, you can start creating automation. Xiaomi owners are most likely to use macros to compensate for the flaws of the shell or add convenient functionality. For example, you can create a macro to automatically turn on the flashlight when you triple tap on the back cover (if the accelerometer sensor is available) or when you shake.

A popular scenario is to automatically save screenshots to the cloud or a separate folder. Macros is built simply: the trigger File modified (path to screenshots) → Action Copy File (to the CloudSync folder).

Example of code for advanced macro
To implement complex logic, you can use the action "Execute" ADB For example: pm grant com.arlosoft.macrodroid android.permission.WRITE_SECURE_SETTINGS. This requires a single connection to the PC.:This action allows you to access hidden system settings that are usually closed to applications without root rights.»

Another useful macro is automatic switching of sound profiles. Trigger: "Connected to Wi-Fi" (Home Network) → Action: "Media Volume" (50%), "Call Volume" (100%). Trigger: "Disconnected from Wi-Fi" → Action: "Call Volume" (0, vibration). This eliminates the need to manually twist sliders when leaving the house.

Owners of Xiaomi gaming smartphones (Black Shark series or POCO with game mode) can use MacroDroid to create their own profiles. Macros can turn off autobrightness and block swipes when a particular game application is launched, which works even more effectively than the built-in Game Turbo in some scenarios.

Solution and debugging of macros

If the macro stopped working, the first thing to do is check the log of events inside the MacroDroid itself. The application details why the macro didn't start: either the trigger didn't work or the action was blocked by the system. The most common error on Xiaomi is the "Action blocked by the system."

A common problem is that the macro works but doesn’t perform actions that require interface interaction (pressing) and this is treated by recalibrating or rechecking the resolution “Mapping on top of other windows.” It’s also worth making sure you don’t have a tightly restricted Do Not Disturb mode that can block visual notifications from MacroDroid.

For deep diagnostics, you can enable debugging mode in the settings of the MacroDroid app itself, which allows you to see all system events in real time, but remember that constant logging can slightly increase battery consumption.

Problem.A Probable Reason for XiaomiDecision
Macros doesn't start.App "killed" by the systemEnable "No Limits" in the battery and auto-run
The "Push" action is not working.No access over the windowsAllow in "Special. opportunities" → "Display on top"
Delayed responseAndroid alarm clock aggregationUse accurate timers or change the trigger
No access to files.Android 11+/MIUI LimitationsUse a system conductor to confirm the path

💡

Expert advice: If you've upgraded your MIUI/HyperOS firmware, be sure to recheck the battery settings for MacroDroid. Updates often reset the default permissions to "Recommended," which breaks all automation.

FAQ: Frequently Asked Questions

Do you need Root rights to run MacroDroid on Xiaomi?
No, Root rights are not required for 95% of macros. A basic set of permissions and settings "No restrictions" is enough. Root may only be required for very specific actions, such as changing system files or deep interface modification, but for conventional automation it is not necessary.
Why did the macro stop working after the MIUI update?
Updates to the MIUI or HyperOS shell often change security and memory management policies. The system could automatically reset MacroDroid resolutions to standard ones. Re-travel: Settings → Applications → MacroDroid → Battery Savings and select "No Limits".
Can I use MacroDroid to unlock my phone?
Direct screen unlocking (bypassing the pin code) is not possible for Android security reasons. However, you can set up a macro that will automatically enter a password (if it is simple) or disable complex password requirements when connecting to a trusted Wi-Fi using security triggers.
Is MacroDroid Planting a Battery on Xiaomi?
When set up correctly (using effective triggers instead of a constant GPS survey), battery consumption is minimal, usually 1-3% per day. The main discharge comes not from the application itself, but from the actions it performs (for example, constant GPS or Bluetooth).

💡

The main secret of MacroDroid stability on Xiaomi is not the creation of complex macros, but the competent configuration of system resolutions and ignoring the “smart” system tips for optimizing the battery for this particular application.