[英]Firebase Notification issue
How to access the title and body of a firebase notification when user click on the notification using Android?当用户使用 Android 单击通知时,如何访问 firebase 通知的标题和正文?
I easily pass a notification message to specific user but I want access message variable at other end for other purpose.我很容易将通知消息传递给特定用户,但我想在另一端访问消息变量以用于其他目的。 what should I do, please suggest?我该怎么办,请建议?
You should use onMessageReceived()
to get the notification
and to access its properties like title
and body
, like below:您应该使用onMessageReceived()
来获取notification
并访问其属性,如title
和body
,如下所示:
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.