Xiaomi Support Thread

MacroDroidDev

Administrator
Staff member
Background App Killing

Xiaomi devices typically have one or more aggressive battery saving features that can prevent apps such as MacroDroid from correctly functioning. In order to prevent the MacroDroid background process being killed it is necessary to configure your device appropriately to disable this app killing functionality.

Great information can be found here: https://dontkillmyapp.com/xiaomi

Please read through this site in detail and try to follow the guide as closely as possible to prevent background app killing.

App not autostarting

Some Xiaomi devices may prevent the app from auto-starting unless explicitly configured to allow it.

Please take a look at this page: https://android-arsenal.com/details/1/6771

Find the section: Xiaomi Auto Start and Battery usage monitoring

Other Xiaomi issues

Please use this thread to report and discuss other Xiaomi specific issues that you believe are related only to Xiaomi devices.
 

roughnecks

Active member
Hello, I'm on version 5.14, Redmi 6A and since the last update my phone keeps killing Macrodroid's Notification Bar.
I have MD locked in recent apps and both MD and the helper app are excluded from battery optimization and have no restriction on energy saver.

To have the bar back I have to go to MD's Notification Bar Options and tap on "Configure Button Bar".

Did you make any change which could possibly make this happen? I also had a "Security" app update not long ago, so that could also be the cause.

Thanks
 

roughnecks

Active member
Hello, I'm on version 5.14, Redmi 6A and since the last update my phone keeps killing Macrodroid's Notification Bar.
I have MD locked in recent apps and both MD and the helper app are excluded from battery optimization and have no restriction on energy saver.

To have the bar back I have to go to MD's Notification Bar Options and tap on "Configure Button Bar".

Did you make any change which could possibly make this happen? I also had a "Security" app update not long ago, so that could also be the cause.

Thanks
This seems to have been fixed by itself, but I got a question now.

I see that MD is listed among the apps which are NOT battery optimized. Did I put it there or it's something that MD does by itself?
Asking because I was trying to install YouTube Vanced and it asks to add another app of theirs (microG) to the battery optimization exclusion list - same as MD. So I did that but for whatever reason, every time I reboot, microG gets optimized again.

If you can shed some light, I'd appreciate.
 

Jacob L

Moderator (Lawsonator)
Hi
Planning to buy Note 10 pro, Android 11, with MIUI 12.5, í think.
Can any1 confirm MD works?
MacroDroid works the very best on rooted devices so you'll need one with an unlocked bootloader and that can be rooted, also it has a variety of custom ROMs available. However, custom skins like MIUI are known for being problematic with MacroDroid
 

pr3jker

Member
Well, I'm not planning to root my new device in the next months, so I'll probably drop MD if it really doesn't work reliably in MIUI
 

pr3jker

Member
Hi every1

This is a tutorial for granting ADB hacks in Xiaomi devices (I used Mi 11i).
We'll use Wireless ADB, not USB, but note it only works on Android 11+ (you can use classic USB Debuggng if your device is not on Android 11)
Note : all commands in this tutorial are "quoted", but you must not insert quotes in the actual command line

A-Initial needs:

1-On the Xiaomi device:
1.1-Enable Developer options (google to find how to do it)
1.2-Enable USB debugging
1.3-Enable Wireless debugging
1.4-Enable USB debugging (Security Options)
1.5.Disable adb authorization timeout

2-On your Mac/PC:
2.1-In order to apply this ADB hacks you will need Google's ADB tool (note that only the latest version works on Android 11+). Get it here:
PC: https://dl.google.com/android/repository/platform-tools-latest-windows.zip
Mac: https://dl.google.com/android/repository/platform-tools-latest-darwin.zip
2.2-Once you have a working adb connection, you will type and run the adb commands from the command line/terminal on your computer:


B-Instructions

1.On the Xiaomi device
11.-Go to: Settings > Additional serttings > Developer Options > Wireless debugging.
1.2-You must pair the device with your Mac/PC on your 1st connection. Use the option "Pair device with pairing code" (Take note of device IP address and port n#, and note the pairing code)

2- On your Mac/PC
2.1-Launch your Terminal /Command line. Run "adb pair [your device IP : port n#]". For example:
"adb pair 192.168.1.128:40225"
2.2-Type your device pairing code when asked (from step 1.2)
2.3-You are now paired with your device!
2.4-Run the command "adb devices -l" to list the connected devices. Your Xiaomi device should be listed.
2.5. Now, you're ready tho fire those ADB hacks commands, whatever they are!.
For example, the 1st Macrodroid command should be: "adb shell pm grant com.arlosoft.macrodroid android.permission.WRITE_SECURE_SETTINGS"
2.6-At the end of your session, type "adb kill-server" before disconnect the device.
THat's it! Hope this helps
 

pr3jker

Member
Hi
I cannot find a way to use the "Mobile data on / off" action on Xiaomi / MIUI 12.5.3, no matter all the required permissions granted through ADB.
Also, UI interaction does work to switch Mobile data on - off, but only when screen is on and unlocked.
Has anyone some clue?
 

roughnecks

Active member
Hi
I cannot find a way to use the "Mobile data on / off" action on Xiaomi / MIUI 12.5.3, no matter all the required permissions granted through ADB.
Also, UI interaction does work to switch Mobile data on - off, but only when screen is on and unlocked.
Has anyone some clue?
Never worked for me too and I'm on Android 9 with MIUI 11.
 

pr3jker

Member
I've installed Secure Settings and granted it full permissions. Then I discovered that the "secure settings" setting called "global mobile_data0" enables (write value 1) or disables (write value 0) the data button on status bar Xiaomi devices.
HOWEVER, it only enables / disables the button, not the mobile data itself... Still a mystery to me how this is possible.
 

Pseudocyclic

Well-known member
Maybe the button display and the button actuation (and/or the actual mobile data) use different settings? - such as global mobile_data0 and global mobile_data1 or something like that.
 

pr3jker

Member
Just discovered that the "secure settings" setting called "global mobile_data1" ALSO needs to be enabled (write value 1) or disabled (write value 0) to enable / disable mobile data on Xiaomi devices.
But wifi must be enabled in both cases when using these settings, for them to work.
Anyway, Xiaomi unrooted users have now a way to access mobile data through Macrodroid.
 

roughnecks

Active member
I've installed Secure Settings and granted it full permissions. Then I discovered that the "secure settings" setting called "global mobile_data0" enables (write value 1) or disables (write value 0) the data button on status bar Xiaomi devices.
HOWEVER, it only enables / disables the button, not the mobile data itself... Still a mystery to me how this is possible.
I believe in my device that setting doesn't even enable the button, but..
Just discovered that the "secure settings" setting called "global mobile_data1" ALSO needs to be enabled (write value 1) or disabled (write value 0) to enable / disable mobile data on Xiaomi devices.
But wifi must be enabled in both cases when using these settings, for them to work.
..I'll give this a go.
 

roughnecks

Active member
Can anyone ELI5 me how do I do the "global mobile_data" variable stuff?
What apps do I need to install other than MD and what's the process?

Thanks
 

Jacob L

Moderator (Lawsonator)
Can anyone ELI5 me how do I do the "global mobile_data" variable stuff?
What apps do I need to install other than MD and what's the process?

Thanks
Use the system setting action in MacroDroid. You don't need to install additional things
 

roughnecks

Active member
Use the system setting action in MacroDroid. You don't need to install additional things
I asked to ELI5 because this is not getting me anywhere.
If you want to help, help, otherwise I can wait for somebody else.
 

Attachments

  • IMG_20210823_222814.jpg
    IMG_20210823_222814.jpg
    94.5 KB · Views: 50
Top