Euan's Blog

Troubleshooting Firebase Cloud Messaging on Android

I've spent the first part of this year at work writing and testing a new Android application, and during the course of this I've stumbled across some devices which seem to have recurring issues with conenctivity to Google's Firebase Cloud Messaging service. This issue manifests with the device no longer receiving notifications after being left to idle for a few hours. In this post, I'll go over some troubleshooting steps that I've found.

Check Firebase Service Status

The first step to take is to double check that the Firebase Cloud Messaging service is not having any operational issues. This can be checked on the Firebase Status Dashboard - simply ensure that the Cloud Messaging service has a green tick next to it. There is also a handy RSS feed you can subscribe to for incidents, though there doesn't seem to be any way to filter this to only report services you are actually using.

Check Your Device's Connectivity to FCM

The next step is to check your device's connectivity to Firebase Cloud Messaging itself.

This can be done from the Phone app, though it should be noted that your device may have a custom phone app from your manufacturer (this is definitely true for Samsung devices) - if this is the case, you need to install the Phone by Google app from the Google Play Store.

The steps to take are as follows:

  1. Open the Phone app.
  2. Open the dialler.
  3. Dial the following: *#*#426#*#*.

The FCM Diagnostics screen should open as soon as you finish typing, without having to hit the call button - if it doesn't appear, hit the call button. If nothing happens, you might be using a custom phone app from your device vendor (looking at you again Samsung...) in which case you need to install the Phone by Google app as explained above.

The screen should look something like the below screenshot:

Screenshot of the FCM diagnostics screen, showing the server as being connected.

There should be a line that says something like Server: Connected. If it says Not connected or something, then there should also be some information about the last close code and when the connection was lost.

You can also press the Events button to see a live trail of events relating to the connection, including incoming messages.

To see further information about the status, click on the menu button at the top right of the screen and check the Advanced view checkbox.

If the status shows FCM as disconnected and it doesn't reconnect, you should check your firewall - see Google's documentation on FCM ports and your firewall.

Unfortunately, I do still have a device which disconnects and steadfastly refuses to reconnect until it's rebooted. Further troubleshooting is needed!