首页 > 解决方案 > 在 Android 的 FirebaseMessagingService 的 remoteMessage 中使用 getTo() 方法。我没有得到 getTo() 值

问题描述

我的 json 身体

{"to" : "registration_token", "notification" : { "body" : "Body of Your Notification", "title": "Title of Your Notification" } }


public void
onMessageReceived(RemoteMessage remoteMessage) {
    PrintLog.log("Device Token :: ", remoteMessage.getTo());
    if (remoteMessage.getNotification() != null) {
        showNotification(remoteMessage.getNotification().getTitle(), remoteMessage.getNotification().getBody());
    }
}

在 PrintLog.log("Device Token :: ", remoteMessage.getTo()) 处获取空值;对于这条线

标签: androidfirebasefirebase-cloud-messaging

解决方案


推荐阅读