-
Notifications
You must be signed in to change notification settings - Fork 16
How can I achieve handling by Infobip's Firebase and my Firebase messaging service?
Olga Koroleva edited this page Mar 11, 2021
·
5 revisions
Let's assume that you use FCM to process push from native backend and you don't want to migrate all the code to use Infobip - there's still some use case where you want to send notifications directly to Firebase. In that case you have your own service that extends FirebaseMessagingService
. Infobip's SDK also extends the same service and if your service is registered in manifest, Infobip's service won't be used for message handling (won't be able to receive notifications).
To solve this issue implement the following code in your Firebase messaging service:
override fun onMessageReceived(remoteMessage: RemoteMessage) {
// checking if received message is sent by Infobip and let it be processed
if (MobileMessagingFirebaseService.onMessageReceived(this, remoteMessage)) {
return
}
// process non-Infobip notifications here
// TODO your code
}
override fun onNewToken(token: String) {
// forwarding necessary Firebase token to Infobip's SDK
MobileMessagingFirebaseService.onNewToken(this, token)
// process Firebase token here
// TODO your code
}
expand to see Java code
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
// checking if received message is sent by Infobip and let it be processed
if (MobileMessagingFirebaseService.onMessageReceived(this, remoteMessage)) {
return;
}
// process non-Infobip notifications here
// TODO your code
}
@Override
public void onNewToken(String token) {
// forwarding necessary Firebase token to Infobip's SDK
MobileMessagingFirebaseService.onNewToken(this, token);
// process Firebase token here
// TODO your code
}
If you have any questions or suggestions, feel free to send an email to [email protected] or create an issue.
- Library events
- Server errors
- Users and installations
- Messages and notifications management
- Inbox
Geofencing API- DEPRECATED- Android Manifest components
- Privacy settings
- In-app chat
- Infobip RTC calls and UI
- Backup rules