Reputation: 3926
I'm using UrbanAirship for my mobile engagement tool in parallel to FCM on Android. Based on the UrbanAirship documentation, in case using my own FirebaseMessagingService
I need to pass the remote message using AirshipFirebaseMessagingService.processMessageSync(this, remoteMessage);
How can I know that the message was not handled by UrbanAirship and I fallback to my own FCM notification builder? There is no return value for the processMessageSync
method. I noticed that because UrbanAirship handles the message in a synchronous way, they are consuming and nullifying the notification
field of the remoteMessage
object. Seems strange to me that they haven't exposed any property or return value.
This is the code that worked for me (part of my AppFirebaseMessageService.java
)
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
AirshipFirebaseMessagingService.processMessageSync(this, remoteMessage);
if (remoteMessage != null && remoteMessage.getNotification() != null) {
handleInternalFcm(remoteMessage);
}
}
Upvotes: 0
Views: 137
Reputation: 3926
I got response from UrbanAirship's support. That's the official way knowning if a message can be handled by UA:
PushMessage pushMessage = new PushMessage(message.getData());
if (pushMessage.containsAirshipKeys()) {
//will be handled by UrbanAirship
}
Upvotes: 1