When using Firebase to integrate cloud messaging or notifications in app, phones running stock android OS receive notifications perfectly whereas phones which have custom UI installed on them from the OEM such as Xiaomi, Letv do not receive any fcm calls.
This is because the OEM's by default add an unrecognized app to the blacklist which prevents it from running in the background and receiving notifications, apps like Whatsapp on the other hand are known apps which are whitelisted by the OEM and can hence receive notifications.
To work around this the user must allow your app to autostart which gives your app the required permission to run in the background and listen for any messages from Firebase. Unfortunately since this is an OEM specific problem and not an android SDK problem, there is no documented api for bringing up the autostart permission manager of a phone.
Each manufacturer has their own version of it with different package names, hence this library was created to curate a list of all the packages used by each OEM for their version of the autostart permission manager.
In Nutshell, In some android devices, push notification is restricted by default. You can enable it, By calling this method. So you can receive push notifications when the app is not in the background or killed.
A Pop-up Dialogue will show after calling this method. You can customize dialogue's text and text color.
If user clicks on "Allow" button. AutoStart setting activity will open where you can whitelist your app.
Updated about 1 year ago