Problem Push notification for Android MIUI

There is a problem receiving Push notifications on Android MIUI (Xiaomi note 4X) when the application is not running. I found the information that I need to add the following code to AndroidManifest.xml:

<receiver
    android:name="myPackage.BootReceiver"
    android:enabled="true"
    android:exported="true"
    android:permission="android.permission.RECEIVE_BOOT_COMPLETED" >
    <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
    </intent-filter>
</receiver>

This code runs the process in the background to receive Push notifications when the main application does not work. Which class is required instead of “myPackage.BootReceiver”? Or maybe there is another solution to the problem.

Are you sure the manifest entries are the right solution? Have you made sure that the payload you send is formatted as required (i.e., it includes the alert element)? See docs for reference.

I found the reason why Push Notifications do not come. This is a MIUI feature. There is a special extra permission - Autostart. If you do not enable it, the application will not be able to run in the background and Push notifications will not work accordingly. Unfortunately, this problem is solved only by the user’s action. The user must manually enable the Android application’s permission for this application.

Alright, clear. Not much we can do about it then.