title: Push notification not showing in Android foreground
body: <p>I've used <code>react-native-fcm</code> for remote notification in android and iPhone.</p>
  
  <p><a href="https://github.com/evollu/react-native-fcm" rel="nofollow noreferrer">react-native-fcm</a></p>
  
  <p>In Android foreground I'm not be able to getting remote notification in notification bar.</p>
  
  <p>In background mode I'm able to getting notification successfully but some how in foreground doesn't.</p>
  
  <p><strong>Android Manifest.xml</strong> </p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
            package="com.nusape"&gt;
  
      &lt;application&gt;
  
          &lt;receiver android:name="com.evollu.react.fcm.FIRLocalMessagingPublisher"/&gt;
          &lt;receiver android:enabled="true" android:exported="true"  android:name="com.evollu.react.fcm.FIRSystemBootEventReceiver"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.BOOT_COMPLETED"/&gt;
                  &lt;action android:name="android.intent.action.QUICKBOOT_POWERON"/&gt;
                  &lt;action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/&gt;
                  &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;/intent-filter&gt;
          &lt;/receiver&gt;
  
          &lt;meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/ic_launcher"/&gt;
          &lt;meta-data android:name="com.google.firebase.messaging.default_notification_channel_id" android:value="my_default_channel"/&gt;
  
          &lt;service android:name="com.evollu.react.fcm.MessagingService" android:enabled="true" android:exported="true"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.google.firebase.MESSAGING_EVENT"/&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
  
          &lt;service android:name="com.evollu.react.fcm.InstanceIdService" android:exported="false"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.google.firebase.INSTANCE_ID_EVENT"/&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
  
  
  
         &lt;activity android:launchMode="singleTop" android:configChanges="keyboard|keyboardHidden|orientation|screenSize" android:windowSoftInputMode="adjustResize"&gt;
  
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
  
              &lt;intent-filter&gt;
                  &lt;action android:name="fcm.ACTION.HELLO" /&gt;
                  &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;/intent-filter&gt;
  
          &lt;/activity&gt;
          &lt;activity android:name="com.facebook.react.devsupport.DevSettingsActivity" /&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p><strong>App.js</strong></p>
  
  <pre><code>async componentDidMount() {
  // create NotificationChannel for future use!
      FCM.createNotificationChannel({
        id: 'my_default_channel',
        name: 'Default',
        description: 'used for example',
        priority: 'high'
      });
  
      // initially user get InitialNotification frim the app if any pending
      FCM.getInitialNotification().then(notif =&gt; {
        console.log("getInitialNotification Notification : =&gt; ", notif);
  
        // if notif.targetScreen is details screen then it will redirect to details screen directly!
        if (notif &amp;&amp; notif.targetScreen === "detail") {
          setTimeout(() =&gt; {
            this.props.navigation.navigate("Detail");
          }, 500);
        }
      });
  
      // added notification listener for getting any notification called below function then
      this.notificationListener =  FCM.on(FCMEvent.Notification, async (notif) =&gt;  {
        console.log("FCMEvent.Notification Notification : =&gt; ", notif);
  
        if (Platform.OS === 'ios' &amp;&amp; notif._notificationType === NotificationType.WillPresent &amp;&amp; !notif.local_notification) {
          notif.finish(WillPresentNotificationResult.All);
          return;
        }
  
        // if user tap to notification bar then open app then below condition will follow up and redirect to details screen!
        if (notif.opened_from_tray) {
          if (notif.targetScreen === 'detail') {
            setTimeout(() =&gt; {
              navigation.navigate('Detail')
            }, 500)
          }
          setTimeout(() =&gt; {
            alert(`User tapped notification\n${JSON.stringify(notif)}`)
          }, 500)
        }
  
        // check whether app is in background or foreground for generate notification
       if (AppState.currentState !== 'background'){
          this.showLocalNotification(notif);
  
  
      });
  
      // getting user permission for sending notification or not ?
      try {
        let result = await FCM.requestPermissions({
          badge: true,
          sound: true,
          alert: true
        });
        console.log("Notification requestPermissions : =&gt; ", result)
      } catch (e) {
        console.error(e);
      }
  
      // Generating token for particular user wise send notification
      FCM.getFCMToken().then(token =&gt; {
        FCM.subscribeToTopic("channelToTopic");
        console.log("Notification token : =&gt; ", token);
        this.setState({ token: token || "" });
      });
  
      // Get APNSTOKEN for only ios
      if (Platform.OS === "ios") {
        FCM.getAPNSToken().then(token =&gt; {
          console.log("APNS TOKEN (getFCMToken)", token);
        });
      }
    }
  
    // show notification when app is in foreground and getting any new notification
    showLocalNotification = (notif) =&gt; {
      FCM.presentLocalNotification({
        channel: 'my_default_channel',
        id: new Date().valueOf().toString(),
        title: notif.fcm.title,
        body: notif.fcm.body,
        priority: "high",
        badge: 1,
        number: 1,
        ticker: "My Notification Ticker",
        auto_cancel: true,
        big_text: "Show when notification is expanded",
        sub_text: "This is a subText",
        wake_screen: true,
        group: "group",
        icon: "ic_launcher",
        ongoing: true,
        my_custom_data: "my_custom_field_value",
        lights: true,
        show_in_foreground: true
      });
    };
  </code></pre>
  
  <p>I'm suffering this issue from last 2 months and not get it well solution for the same as i doing so many new attempt to resolve issue but at the end not getting any succeed.</p>