簡體   English   中英

Firebase 通知問題

[英]Firebase Notification issue

當用戶使用 Android 單擊通知時,如何訪問 firebase 通知的標題和正文?

我很容易將通知消息傳遞給特定用戶,但我想在另一端訪問消息變量以用於其他目的。 我該怎么辦,請建議?

您應該使用onMessageReceived()來獲取notification並訪問其屬性,如titlebody ,如下所示:

class CustomFirebaseMessagingService : FirebaseMessagingService() {

    override fun onMessageReceived(remoteMessage: RemoteMessage) {
        val notificationTitle = remoteMessage.notification?.title
        val notificationBody = remoteMessage.notification?.body
    }

暫無
暫無

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

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