Android did not receive remote notifications when app is in foreground
See original GitHub issueBug
App is not receiving any remote notifications when app is in foreground state. Background remote notifications are working correctly.
I’ve also set this to true
in manifest file:
<!-- 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"/>
Environment info
react-native info
output:
System:
OS: Windows 10 10.0.18363
CPU: (4) x64 Intel(R) Core(TM) i5-3570 CPU @ 3.40GHz
Memory: 1.22 GB / 7.88 GB
Binaries:
Node: 12.9.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.10.2 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK:
API Levels: 28, 29
Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.0
System Images: android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: Not Found
Languages:
Java: 1.8.0_221 - C:\Program Files\Java\jdk1.8.0_221\bin\javac.EXE
Python: 2.7.16 - C:\Python27\python.EXE
npmPackages:
@react-native-community/cli: Not Found
react: 16.11.0 => 16.11.0
react-native: 0.62.2 => 0.62.2
npmGlobalPackages:
*react-native*: Not Found
Library version: 3.5.2
Steps To Reproduce
- Install app on real device
- Get device token and send test message from firebase while app is in foreground …
Describe what you expected to happen:
- App should receive notification even in foreground if we specify the line in manifest
Ps. I’m using the example app for now, so the configs are same
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:8
Top Results From Across the Web
How to handle the Firebase notification when app is in ...
When app is in foreground, notifications are not generated themselves. You need to write some additional code. When message is received onMessageReceived() ...
Read more >Receive messages in an Android app - Firebase - Google
When your app is in the background, Android directs notification messages to the system tray. A user tap on the notification opens the...
Read more >FCM push notification is not working when the app in foreground
The push notification is getting displayed when application is killed or background/ not visible (i.e. by pressing device home button). But the ...
Read more >Foreground services - Android Developers
Foreground services show a status bar notification, so that users are actively aware that your app is performing a task in the foreground...
Read more >Notifications Not Shown - Mobile Push
Step 2: Settings --> Apps or Notification Manager --> Advanced or Notify for your app --> Ignore Battery Optimizations, select the app and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello @theasc Thank you for pointing that out, somehow I missed that. Sorry @Dallas62 for taking your time on this. Thanks for your great work!
Hi @Dallas62, It works now I was just missing the following part:
<service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService" android:exported="false" > <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT" /> </intent-filter> </service>