Spring boot Firebase消息传递数据有效负载在Spring引导时为空

Spring boot Firebase消息传递数据有效负载在Spring引导时为空,spring-boot,firebase-cloud-messaging,Spring Boot,Firebase Cloud Messaging,我正在使用firebase管理员(版本为7.1.1)发送推送通知。在onMessageReceived(m:RemoteMessage)方法中,数据和通知为null;当应用程序在后台运行时,不会调用此方法,因为这是系统的正常行为。我每次都需要发送数据字段。发送请求时,我没有任何错误。这就是我发送推送通知的方式: val builder = Message.builder() .setTopic(topic) .putData(&qu

我正在使用firebase管理员(版本为7.1.1)发送推送通知。在onMessageReceived(m:RemoteMessage)方法中,数据和通知为null;当应用程序在后台运行时,不会调用此方法,因为这是系统的正常行为。我每次都需要发送数据字段。发送请求时,我没有任何错误。这就是我发送推送通知的方式:

val builder = Message.builder()
                .setTopic(topic)
                .putData("type", "NEWS")
                .setNotification(
                     Notification.builder()
                       .setTitle(title)
                       .setBody(content)
                       .build()
                )

try {
      firebaseMessaging.send(builder.build())
} catch (e: Exception) {
      logger.error(e.message, e)
}

你有任何错误日志吗?没有,没有任何错误