簡體   English   中英

如何知道Android中Firebase通知中的哪個主題名稱?

[英]How to know which topic name in Firebase Notification in Android?

我正在開發一個應用程序,我已經集成了Firebase來處理通知。 我只想知道如何獲得從后端團隊發送給我的主題名稱。 有三個主題,根據主題,我必須以不同的布局顯示消息。 我得到這樣的頭銜和身體:

    if (remoteMessage.getData().size() > 0) {
        //handle the data message here
    try {
        String title = remoteMessage.getNotification().getTitle();
        String body = remoteMessage.getNotification().getBody();
        Log.e("TITLE AND BODY", title + "\n" + body);

    } catch (Exception e) {
        e.printStackTrace();
    }
}

onMessageReceived() ,只需使用RemoteMessage.getFrom()

獲取此郵件的發件人。

這將是發件人ID或主題消息的主題。

如果收到的消息來自主題,則應返回主題名稱的值。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM