How to know “topic” name from Firebase notificatio

2020-04-05 08:13发布

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.

1条回答
▲ chillily
2楼-- · 2020-04-05 08:49

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)

查看更多
登录 后发表回答