react-native-push-notification icon indicating copy to clipboard operation
react-native-push-notification copied to clipboard

Notification is appearing in foreground only on Android

Open alex-mironov opened this issue 6 years ago • 2 comments

I have an issue with notifications sent through FCM are appearing only when the app is in the foreground.

I'm using RN 0.61.4 among with firebase:

    "@react-native-firebase/app": "^6.2.0",
    "@react-native-firebase/messaging": "^6.2.0",
    "react-native-push-notification": "^3.1.9",

Would be grateful for any hint 🙏

I rely on auto-linking so I didn't run link. Here is AndroidManifest.xml

    <uses-permission android:name="android.permission.WAKE_LOCK" />

...
    <permission
        android:name="${applicationId}.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />
    <uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
...
      <receiver
          android:name="com.google.android.gms.gcm.GcmReceiver"
          android:exported="true"
          android:permission="com.google.android.c2dm.permission.SEND" >
          <intent-filter>
              <action android:name="com.google.android.c2dm.intent.RECEIVE" />
              <category android:name="${applicationId}" />
          </intent-filter>
      </receiver>

      <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" />
          </intent-filter>
      </receiver>
      <service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationRegistrationService"/>
      <service
          android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
          android:exported="false" >
          <intent-filter>
              <action android:name="com.google.firebase.MESSAGING_EVENT" />
          </intent-filter>
      </service>
    </application>

alex-mironov avatar Dec 11 '19 21:12 alex-mironov

I had the same problem, fixed it by removing this receiver <receiver android:name="com.google.android.gms.gcm.GcmReceiver"

odedkeren1 avatar Jan 16 '20 09:01 odedkeren1

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jan 16 '21 01:01 github-actions[bot]