繁体   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