Fixing FCM Push Notifications: Solutions for Common Issues

Category Quality Assurance

Firebase Cloud Messaging (FCM) is a cross-platform messaging solution that lets you reliably deliver messages at no cost.

Using FCM:

1.You can notify a client app that new email or other data is available to sync.
2.You can send notification messages to drive user re-engagement and retention.

For use cases such as instant messaging, a message can transfer a payload of up to 4KB to a client app.

Detailed information on Firebase Cloud Messaging can be found in here:

But there are some situations where we need to fix the issues related to FCM push notifications such as:

1.Notification is not working in the Oreo.
2.Notification is not working as a background service in One plus 3/3T.

In situation one, Oreo, the latest version of Android, supports some methods and classes which are not used by the legacy code present in the application.

The below mentioned line of code snippet will help you fix it.

 int importance = NotificationManager.IMPORTANCE_HIGH;
 NotificationChannel mChannel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, title, importance);
view rawfcm hosted with ❤ by GitHub

In situation two, where the notification is not working as a background service in One plus 3/3T, turn your battery optimisation off and it’s done. You will now receive the push notification.

Ready to embark on a transformative journey? Connect with our experts and fuel your growth today!