Traditionally, Xiaomi and their Android customization called MIUI belongs to the most troubled group on the market with respect to non-standard background process limitations and non-standard permissions. In default settings, background processing simply does not work right and apps using them will break.
The main restrictive setting is called Autostart. It may vary on different Xiaomi smartphones.
To turn it on:
- Go to your Settings → Manage apps..
- Scroll down to your app and tap on it.
- Enable Autostart.
- Tap on Autostart and ensure both options are toggled on.
Another way to enable Autostart:
- Open Security app → Permissions
- Tap on Autostart
- Search your app and turn on toggle next to it
App permissions and a Battery Saver setting
- From your app's battery screen, tap on App permissions.
- Turn on Show on Lock screen, Start in background, and Display pop-up window.
- Go back to your app's battery screen and verify that Other permissions say Allowed for 3 permissions. Scroll down and tap on Battery saver.
- Choose the No restrictions option.
- Go back to your app's battery screen and verify that all 3 sections has successfully changed. Battery saver should now show No restrictions.
When you open the recent apps tray, drag your app downwards (it will be locked). So, even if you clear recent apps, it will not clear them from the background. Drag downwards again to clear your app from the background.