Troubleshooting Firebase Cloud Messaging on Android
Published: 2022-04-09 19:09:35

---
title: Troubleshooting Firebase Cloud Messaging on Android
published: true
date: 2022-04-09 18:34:00 UTC
tags: 
canonical_url: https://www.euantorano.co.uk/posts/2022/04/09/android-troubleshoot-fcm/
---

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](https://status.firebase.google.com) - simply ensure that the `Cloud Messaging` service has a green tick next to it. There is also a [handy RSS feed](https://status.firebase.google.com/en/feed.atom) 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](https://play.google.com/store/apps/details?id=com.google.android.dialer&hl=en_GB&gl=US) 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#*#*`.

4. 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 as connected](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dweud2i6imclfhm4tx6d.jpg)
 
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](https://firebase.google.com/docs/cloud-messaging/concept-options#messaging-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!