OnNotificationOpen在Android emulator中工作,但在实际设备中不工作

OnNotificationOpen在Android emulator中工作,但在实际设备中不工作,android,firebase,react-native,firebase-cloud-messaging,react-native-android,Android,Firebase,React Native,Firebase Cloud Messaging,React Native Android,我正在react本机应用程序中使用firebase通知模块。它在emulator中工作得很好,但当我在mobile中安装应用程序时,在打开通知时,onNotificationOpened事件侦听器从未被调用。我错过了什么 环境 开发操作系统:Windows 构建工具: this.notificationOpenedListener = firebase.notifications().onNotificationOpened((notificationOpen) => {

我正在react本机应用程序中使用firebase通知模块。它在emulator中工作得很好,但当我在mobile中安装应用程序时,在打开通知时,onNotificationOpened事件侦听器从未被调用。我错过了什么

环境

  • 开发操作系统:Windows
构建工具:

  this.notificationOpenedListener = firebase.notifications().onNotificationOpened((notificationOpen) => {
      Linking.openURL('https://www.google.com/');
  });

  /*
  * If your app is closed, you can check if it was opened by a notification being clicked / tapped / opened as follows:
  * */
  const notificationOpen = await firebase.notifications().getInitialNotification();
  if (notificationOpen) {
      Linking.openURL('https://www.google.com/');
  }
  • React本机版本:0.60.5
  • React本机Firebase版本:5.5.6
  • Firebase模块:通知
代码片段:

  this.notificationOpenedListener = firebase.notifications().onNotificationOpened((notificationOpen) => {
      Linking.openURL('https://www.google.com/');
  });

  /*
  * If your app is closed, you can check if it was opened by a notification being clicked / tapped / opened as follows:
  * */
  const notificationOpen = await firebase.notifications().getInitialNotification();
  if (notificationOpen) {
      Linking.openURL('https://www.google.com/');
  }

您是否授予应用程序通知权限?@Lenoarod我正在移动设备中接收通知。但是当我在androidmanifest.xml文件中添加下面的代码后,当单击通知时,没有一个事件侦听器工作