Battery optimization is blocking the push notifications

Hi all, I’m using cordova-fcm-plugin in my application, to receive push notification. Everything works fine till Android Version 7. But for Android version 8 and above “Battery Optimization” property is blocking the app from receiving the notifications. If I go to settings -> battery -> battery optimizations and don’t optimize my app then notifications will work fine.
But mine is a B2C app, I cannot ask user to go to settings and perform these changes. I need to achieve this functionality pragmatically. Please help me to achieve the same.

https://www.freecodecamp.org/news/why-your-push-notifications-never-see-the-light-of-day-3fa297520793/

in same time:

Google firebase notification documentation:
Cloud messaging

High priority. FCM attempts to deliver high priority messages immediately, allowing the FCM service to wake a sleeping device when necessary and to run some limited processing (including very limited network access). High priority messages generally should result in user interaction with your app or its notifications. If FCM detects a pattern in which they don’t, your messages may be de-prioritized. Android P introduced app standby bucketswhich limit the number of FCM high priority messages you can send to your app that don’t result in the user using your app or viewing a notification. If, in response to a high priority message, a notification is displayed in a way that is visible to the user, then your app standby bucket quota will not be consumed by that message.