Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Notification popup not showing when app at background - Android

See original GitHub issue


Remote notification doesn’t pop up on Android when app is in background. I did receive the notification at onNotification though. Side note: Notification pop up was working back in version 3.2.1. At that time, both notifications from firebase console and my own api will trigger onNotification and show popup. However with the current version, using firebase console will show the notification in notification tray but doesn’t popup nor trigger onNotification while using my api will trigger onNotification but does not show popup.

Environment info

react-native info output:

    OS: macOS Mojave 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
    Memory: 39.16 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
    Node: 13.7.0 - /usr/local/bin/node
    Yarn: 1.17.0 - /usr/local/bin/yarn
    npm: 6.14.2 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      Android NDK: 20.0.5594570
    Android Studio: 3.5 AI-191.8026.42.35.6010548
    Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
    @react-native-community/cli: ^2.9.0 => 2.10.0 
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.5 => 0.61.5 
    react-native-cli: 2.0.1

Library version: 3.4.0

Steps To Reproduce

  1. Install & setup react-native-push-notification
  2. Use Firebase console to send test message = Notification popup showed but onNotification not triggered
  3. Use own api to send notification = Notification popup not showed but onNotification triggered

Describe what you expected to happen:

  1. Notification pop up when app is in background/exit

Reproducible sample code

  1. npm i --save react-native-push-notification@3.4.0
  2. Set up androidmanifest.xml and gradle file as per instruction
  3. Set up code as follow:

            onRegister: function (token) {
              console.log("TOKEN:", token);

            // (required) Called when a remote or local notification is opened or received
            onNotification: function(notification) {
              console.log("NOTIFICATION:", notification);
              // process the notification here
              // required on iOS only 
            // Android only
            senderID: "XXXXXX", //This is hidden to protect my own project 
            // iOS only
            permissions: {
              alert: true,
              badge: true,
              sound: true
            popInitialNotification: true,
            requestPermissions: true

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:16

github_iconTop GitHub Comments

Dallas62commented, May 10, 2020

And what is the message send from server-side:

 "to" : "...",
 "collapse_key" : "type_a",
 "notification" : {
     "title": "Title of Your Notification",
     "body" : "Body of Your Notification"
 "data" : {
     "title": "Title of Your Notification from data background",
     "message" : "Body of Your Notification from data background"
mfaisalabbasicommented, Sep 8, 2020

@muriloneo having same issue notification sounds and pops up when app in foreground but when app closed or background notification silently show icon on notification tray (or area where notification icon show). how to implement same function for all states like social media messenger do. @Dallas62 if you have solution kindly spare some kind time

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android Notifications Not Showing Up? 10 Fixes You Can Try
Not seeing notifications show up on your Android phone? Try these fixes to get Android notifications working again.
Read more >
How to Fix Notifications Not Showing up on Android - Lifewire
Cause of Notifications Not Showing up on Android · Do Not Disturb or Airplane Mode is on. · Either system or app notifications...
Read more >
FCM notification doesn't show notification pop up in background
Heads up notifications are used in app and I do get the notification but notification doesn't pop up as it do while app...
Read more >
Notifications Not Shown - Mobile Push
Android Settings App > Notifications > Your App you should see "Show notifications" enable and all categories underneath enabled.
Read more >
How exactly do apps not running "in the background" receive ...
Well that's not correct. Since Android 8 apps cannot run background services. They either need to run a foreground service (with persistent ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found