How to know “topic” name from Firebase notification on iOS

你说的曾经没有我的故事 提交于 2020-01-11 08:42:45

问题


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:


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)



来源:https://stackoverflow.com/questions/47737214/how-to-know-topic-name-from-firebase-notification-on-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!