No control on received push notifications on Android

Hi, we just integrated the CometChat SDK on our Android app with the push notifications extensions enabled.

Everything is working great regarding the reception of notifications itself, however what’s weird is that they seem to be handled by a service other than the one we registered in AndroidManifest.xml. We added logs and breakpoints in our service but they never appeared or are triggered. But the notifications are shown, in a somewhat generic way. We’d like to handle them ourselves to customize their appearance and actions.

Based on the documentation, it doesn’t seem like the CometChat SDK is providing a default service and the one we registered should be the one receiving the notifications. Are we missing something? Not sure if it is relevant but we’re using the token-based notifications (v2).

Edit: here’s what our service declaration looks like in the manifest:

<service
    android:name=".service.NotificationsService"
    android:exported="false">

    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>

</service>

We also tried to mark it as exported but it didn’t solve the issue.

Best,
Eric

Upon further testing, it turns out this was due to “Android - Send notification key” being enabled in CometChat’s Push Notifications Settings, which causes FCM to send a “display” notification that’s automatically shown when the app is not in the foreground. With the option disabled, our service does receive the notifications all the time.

More info on the two types of messages (display vs data) can be found here: About FCM messages  |  Firebase

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.