Security (App) --> Permissions --> Autostart - Enable your app
Settings --> Developer Options. Disable "memory optimization". To enabled Developer Options go to Settings --> About. Tap on MIUI 8 times. Full Instructions
Huawei
Step 1: settings --> advanced settings --> battery manager --> select the app to protect it.
Step 2: settings --> apps --> advanced --> ignore battery optimizations, select the app and ignore it.
Step 3: settings --> notification panel & status bar --> notification center, select the app, then activate "allow notifications" and also "priority display".