Issue Receiving CometChat Push Notifications (Android)

Hi, we are having issues in receiving CometChat push notifications on currently tested Android devices. We are able to successfully subscribe to a Group topic and get a status “Subscribed: 200” return.

What is odd is we can send test notifications from Firebase Cloud Messaging services and receive on the device background.

When testing in-app with CometChat though, it doesn’t seem to work. We have monitored from Andriod Studio debugger and see a response when testing with Firebase Cloud Messaging but nothing appears when testing CometChat in-app.

Also, looking at Cloud Messaging reporting, we can see that none of the CometChat notifications are being sent/delivered to Firebase.

This is the documentation we have followed.

Finally, tried CometChat.CometChatHelper.processMessage() to convert the notification payload.

Any tips or suggestions would be greatly appreciated.

Angular CLI: 10.0.4
Node: 12.13.0
OS: win32 x64

Ionic: 5.4.16
@cometchat-pro/cordova-ionic-chat": “^2.0.11”
@ionic-native/fcm": “^5.28.0”, // cordova-plugin-fcm-with-dependecy-updated

This is really frustrating. We have concluded that it could be 1 of 2 problems.

  1. CometChat and FCM are not connected. We have verified that we are using the correct FCM server key from Firebase but it still does not work.

  2. CometChat is sending the payload incorrectly and FCM is rejecting it.

Could someone please help us? This is the last project requirement before we can launch and we are stuck with what to do next.

Thank you CometChat team.

Kyle

Hello @kl2000,

Sorry for the delay in the response. I will check this on our end and get back to you with an update.

Warm Regards,

Mayur Bhandari
CometChat Pro

No problem at all @mayur.bhandari. Thank you for looking into this. We’re a bit stuck.

Hi @mayur.bhandari did you have a chance to look into this? We also tried using a capacitor plugin to see if we would get different results.

https://capacitorjs.com/docs/guides/push-notifications-firebase

Again, we receive Firebase notifications but not from CometChat. Thanks!

Hello @kl2000,

Can you please let us know the region of your app & appId? Also, can you share some sample user UIDs so that we can test it on our end?

Warm Regards,

Mayur Bhandari
CometChat Pro

Hi @mayur.bhandari here are a few test uids.

  • kyletest
  • anothertest
  • testuser

The region is “us”.

Is it safe to send the appID through the forum?

Thanks!

@mayur.bhandari I believe we may have this working. It seems there was an issue with how we were retrieving the device token from Firebase when using the FCM Plugin.

The Capacitor Push Notification API has a listener that retrieves the device token. So you don’t have to manually retrieve and store the token. Once we passed the new token to CometChat… It worked!
Thank you for your help. We will need to clean up our code a bit and begin setting up for IOS.

Kyle

1 Like

@mayur.bhandari question. Is there a way to customize the message that is being sent to the background? Currently, it is showing the users’ email address and we do not want to display user email addresses in our app.

We can intercept the message in the foreground and customize, just not sure how to handle the background notification.

Thank you sir.
Kyle