Debug Your Infrastructure

Get Instant Solutions for Kubernetes, Databases, Docker and more

AWS CloudWatch
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Pod Stuck in CrashLoopBackOff
Database connection timeout
Docker Container won't Start
Kubernetes ingress not working
Redis connection refused
CI/CD pipeline failing

Firebase Cloud Messaging NotRegistered error when sending push notifications.

The registration token is no longer valid and needs to be refreshed.

Understanding Firebase Cloud Messaging

Firebase Cloud Messaging (FCM) is a cross-platform messaging solution that allows you to reliably send messages at no cost. It enables developers to send notifications and messages to users across different platforms, including Android, iOS, and web applications. FCM is widely used for push notifications, which are essential for engaging users and keeping them informed about updates or new content.

Identifying the Symptom

When using FCM, you might encounter the NotRegistered error. This error typically occurs when you attempt to send a push notification, but the registration token you are using is no longer valid. As a result, the message fails to deliver, and you receive an error response indicating that the token is not registered.

Common Observations

  • Push notifications are not reaching the intended devices.
  • Error logs show a NotRegistered error code.
  • Users report not receiving notifications despite being subscribed.

Explaining the NotRegistered Issue

The NotRegistered error is a common issue in FCM that indicates the registration token used for sending messages is invalid. This can happen for several reasons, such as:

  • The app was uninstalled and reinstalled, generating a new token.
  • The token has expired or been revoked.
  • The user has logged out or cleared app data, invalidating the token.

For more details on FCM error codes, you can refer to the Firebase documentation.

Steps to Resolve the NotRegistered Error

To resolve the NotRegistered error, follow these steps:

Step 1: Request a New Registration Token

Ensure that your client app requests a new registration token whenever it starts. This can be done by implementing the onNewToken callback in your app's Firebase messaging service. Here is an example for Android:

public class MyFirebaseMessagingService extends FirebaseMessagingService {
@Override
public void onNewToken(String token) {
Log.d("FCM", "Refreshed token: " + token);
sendRegistrationToServer(token);
}

private void sendRegistrationToServer(String token) {
// Implement this method to send token to your app server.
}
}

Step 2: Update Your Server

Once you have a new token, update your server with this token. Ensure that your server logic handles token updates correctly to avoid using outdated tokens.

Step 3: Handle Token Refreshes

Implement logic in your app to handle token refreshes. This ensures that your app always uses the latest token for sending notifications.

Conclusion

By following these steps, you can effectively resolve the NotRegistered error in Firebase Cloud Messaging. Keeping your registration tokens up-to-date is crucial for ensuring reliable message delivery. For further reading, check out the Firebase Cloud Messaging Android Client Setup guide.

Master 

Firebase Cloud Messaging NotRegistered error when sending push notifications.

 debugging in Minutes

— Grab the Ultimate Cheatsheet

(Perfect for DevOps & SREs)

Most-used commands
Real-world configs/examples
Handy troubleshooting shortcuts
Your email is safe with us. No spam, ever.

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

🚀 Tired of Noisy Alerts?

Try Doctor Droid — your AI SRE that auto-triages alerts, debugs issues, and finds the root cause for you.

Heading

Your email is safe thing.

Thank you for your Signing Up

Oops! Something went wrong while submitting the form.

MORE ISSUES

Deep Sea Tech Inc. — Made with ❤️ in Bangalore & San Francisco 🏢

Doctor Droid