React-native-push-notification: Push notification not showing in foreground

Created on 17 Oct 2018  路  12Comments  路  Source: zo0r/react-native-push-notification

Push notifications are working, if the app in the closed state. But not working, if the app is in the foreground.
I am using FCM.

Most helpful comment

Change the value to true to enable pop-up for in foreground (remote-only, for local use ignoreInForeground)
Inside meta-data android:name="com.dieam.reactnativepushnotification.notification_foreground"
android:value="true".

All 12 comments

Hi,

I was experiencing the same issue then noticed a difference in the AndroidManifest.xml config.
This fixed it for me

android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerServiceGcm

@timbielawski this is for gcm But what to do if I want fcm foreground push notification.

This worked for me:
I updated my AndroidManifest.xml with instructions shown on this page.
https://rnfirebase.io/docs/v4.2.x/messaging/android

This worked for me:
I updated my AndroidManifest.xml with instructions shown on this page.
https://rnfirebase.io/docs/v4.2.x/messaging/android

@zashishz can you explain what you change or can you add androidManifest.xml file here

This worked for me:
I updated my AndroidManifest.xml with instructions shown on this page.
https://rnfirebase.io/docs/v4.2.x/messaging/android

@zashishz can you explain what you change or can you add androidManifest.xml file here

@akshgods I made these changes as mentioned in link for AndroidManifest.xml.

<application ...>
  <service android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService">
    <intent-filter>
      <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
  </service>
  <service android:name="io.invertase.firebase.messaging.RNFirebaseInstanceIdService">
    <intent-filter>
      <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
    </intent-filter>
  </service>
</application>

Change the value to true to enable pop-up for in foreground (remote-only, for local use ignoreInForeground)
Inside meta-data android:name="com.dieam.reactnativepushnotification.notification_foreground"
android:value="true".

@TaraSinghDanu

i change according to doc but it does not work

`

















<!-- Change the value to true to enable pop-up for in foreground (remote-only, for local use ignoreInForeground) -->
<meta-data android:name="com.dieam.reactnativepushnotification.notification_foreground" android:value="true" />
<!-- Change the resource name to your App's accent color - or any other color you want -->
<meta-data android:name="com.dieam.reactnativepushnotification.notification_color" android:resource="@color/white" /> <!-- or @android:color/{name} to use a standard color -->

<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationActions" />
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">
  <intent-filter>
    <action android:name="android.intent.action.BOOT_COMPLETED" />
    <action android:name="android.intent.action.QUICKBOOT_POWERON" />
    <action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
  </intent-filter>
</receiver>

<service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService" android:exported="false">
  <intent-filter>
    <action android:name="com.google.firebase.MESSAGING_EVENT" />
  </intent-filter>
</service>


`

make value true if false and use version 5.1.1.
i have same issue in version 6. version 5.1.1 hava all kinds of notifications

Hi @AhmedRazaVerge
Do not ask for rollback versions. The v6 have breaking changes describe in the CHANGELOG and RELEASE NOTE.
Please read documentation before asking rollback.

Dear @Dallas62
i was using the v6.i read the all doc and changelog.

<!-- Change the value to true to enable pop-up for in foreground (remote-only, for local use ignoreInForeground) -->
<meta-data android:name="com.dieam.reactnativepushnotification.notification_foreground" android:value="true" />

i make changes according to the documentation to get notification pop in foreground but i did not get pop of notification.i just get the notification object.
so i try version 5.1.1 because i am using the this version in another project it works fine.
when i downgrade from v6 to 5.1.1 in current project i work.i get the notification popup.

Hi @AhmedRazaVerge
If you take a look in the last ten issues you will get an answer to this issue.
Regards

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NiuQiaoling picture NiuQiaoling  路  3Comments

uendar picture uendar  路  3Comments

ahmadallo1 picture ahmadallo1  路  3Comments

ssolida picture ssolida  路  3Comments

cidevant picture cidevant  路  3Comments