Android Question Problem with firebase notification

I create a simple messanger app and use firebase notification for receive new message.
I use firebase like this:
It usually works well but some time firebase not receive any message for few minutes and firebasemessage service not start when new meesage sended, it look like firebase disconnected from server but it is impossible and i think this problem from my app.
So, how i can prevent from happening this problem and firebase always work and receive???or how i can check and keep firebase connection??
If you are able to receive messages while the app is not running then Firebase is configured properly. Restart the phone, don't run anything and send a message. Was it received?
When restart phone or reconnect internet it is work again but i won't do this because my app published and have users
and this problem happen some time , also if you wait a few minutes and not do anything it solve automatically!
It sounds like your app is configured properly.

Don't assume that all notifications will arrive immediately. Once your app starts you should connect to YOUR server and download all messages.
Ok , thanks , maybe i can do this.
Also :exist a code or function for check firebase new notification and message when app started??