React-native android 推送通知清除徽章

Rém*_*émy 5 android push-notification firebase react-native

我正在构建一个应用程序,并且正在使用带有 firebase 的推送通知。一切正常,除了我不明白的一件小事。收到通知时,徽章会增加。当我通过通知打开应用程序时,或者如果应用程序关闭或在后台直接点击应用程序,徽章设置为 0。它在 iOS 上完美运行,几乎在 android 上运行。如果我直接通过点击打开应用程序而不通过通知,我无法清除徽章......这是我的代码:

async componentDidMount() {
      this.checkPermission();
      this.createNotificationListeners();
      AppState.addEventListener('change', this._handleAppStateChange);
      firebase.notifications().setBadge(0);
  }

  componentWillUnmount() {
    AppState.removeEventListener('change', this._handleAppStateChange);
  }

   _handleAppStateChange = async (nextAppState) => {
    if (
      this.state.appState.match(/inactive|background/) &&
      nextAppState === 'active'
    ) {
      firebase.notifications().setBadge(0);
    }
  };
Run Code Online (Sandbox Code Playgroud)

有什么我做错了吗?