[英]Firebase FCM Notification issue in OREO version Android Phone
[英]Firebase Notification issue
当用户使用 Android 单击通知时,如何访问 firebase 通知的标题和正文?
我很容易将通知消息传递给特定用户,但我想在另一端访问消息变量以用于其他目的。 我该怎么办,请建议?
您应该使用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.