I'm trying to use Firebase in my iOS application. I successfully integrated it and receiving notifications from all 3 Targets (user segment, topic and single device). My question is how to know a particular notification is received from which topic?
I'm following this documentation and this github page
EDIT:
I'm testing on iOS11.2 (XCode9.2) & my response (userInfo) is:
{
aps = {
alert = test;
sound = default;
};
"gcm.message_id" = "0:1513282329413512%38894e8e28894e8e";
"gcm.n.e" = 1;
"gcm.notification.sound2" = default;
"google.c.a.c_id" = 1542306492273623048;
"google.c.a.c_l" = test;
"google.c.a.e" = 1;
"google.c.a.ts" = 1513182256;
"google.c.a.udt" = 0;
}
I'm getting gcm.message_id
but it looks like "gcm.message_id" = "0:1512894251264950%38894e8e38894e8e";
How to map this to my topic name?
Thanks.
For Apple client apps, you can receive notification and data payloads up to 4000 bytes over the Firebase Cloud Messaging APNs interface. To write your client code in Objective-C or Swift, we recommend that you use the FIRMessaging API.
Based on the publish/subscribe model, FCM topic messaging allows you to send a message to multiple devices that have opted in to a particular topic. You compose topic messages as needed, and FCM handles routing and delivering the message reliably to the right devices.
I got the answer from Firebase support team.
It doesn't seem like there's a way to get this info as per documentation. One workaround I can think of is if you would pass the topic name in your data payload, you can then manually handle it from your code and map it to your message_id.
So looks like this works on Android but on iOS it's not supported today (Dec 2017)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With