簡體   English   中英

Android Firebase:當應用程序處於前台時如何從Firebase獲取通知消息的消息文本組件

[英]Android Firebase : how get the message text component of notification message from firebase when app is in foreground

當我們只有可以通過Firebase控制台發送的通知(顯示消息)時,當我們的應用程序位於Foreground中時,將調用FirebaseMessagingService的onMessageReceived方法。 為了獲得通知,我創建了工作正常的通知生成器。 我面臨的唯一問題是檢索消息內容,因為它不是數據通知,所以remotemessage.getData()為null,甚至remotemessage.getNotificationBody()也為null。 我已經調試了程序,remoteMessage具有一個字段來存儲發送的消息,但我無法檢索它。 請幫我。 隨附的快照顯示了從Firebase控制台發送的必填消息字段,並以黃色突出顯示。 Firebase控制台消息窗口

我明白了..它是如此簡單::) getNotification()。getBody();

暫無
暫無

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

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