Android 当FCM的应用程序在后台时,额外的意图数据将变为null

Android 当FCM的应用程序在后台时,额外的意图数据将变为null,android,firebase,firebase-cloud-messaging,Android,Firebase,Firebase Cloud Messaging,详情: Android设备:Nexus5或emulator 安卓操作系统版本:安卓N或安卓M 谷歌播放服务版本:9.2.1 Firebase/Play Services SDK版本:9.2.1 观察结果: 尽管通知确实出现在系统托盘中,但数据在系统中不可用。在onNewIntent或onCreate中,附加值为空 预期成果: 根据Firebase Cloud Messaging文档,当应用程序状态为后台且发送了包含数据的通知时,通知将显示在系统托盘中,并且数据将在意向书的附加部分中可用 @O

详情:

  • Android设备:Nexus5或emulator
  • 安卓操作系统版本:安卓N或安卓M
  • 谷歌播放服务版本:9.2.1
  • Firebase/Play Services SDK版本:9.2.1
观察结果:

尽管通知确实出现在系统托盘中,但数据在系统中不可用。在
onNewIntent
onCreate
中,附加值为空

预期成果:

根据Firebase Cloud Messaging文档,当应用程序状态为后台且发送了包含数据的通知时,通知将显示在系统托盘中,并且数据将在意向书的附加部分中可用

@Override
public void onCreate() {
Bundle extras = getintent().getExtras();
---> extras is always null when app is not running or when app is in background
}


备注:当应用程序状态位于前台时,数据可用。但是通知控制台对于这个bug几乎不可用,因为所有(后台、应用程序未运行、前台)用户都需要能够在通知中获取数据。否则,开发人员如何知道用户看到或没有看到哪些数据(例如,是否向用户显示了10%的折扣)。

Hi。你能发布你正在发送的有效载荷样本吗?另外,你是否只会遇到这种特定于你在帖子中提供的细节的行为?我也有同样的问题。没有解决办法?
@Override
public void onNewIntent(Intent intent) {
Bundle extras = intent.getExtras();
---> extras is always null when app is not running or when app is in background
}