![](/img/trans.png)
[英]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.