question-mark
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 appearing in when in background or quit state.

See original GitHub issue

Bug

Hi, I’m having an issue while receiving notification when the app is in the background or killed in fact I can see the notification is received, can see the icon in the status bar, vibration working like normal but no popup appears.

Please find below my environment and config info, Thanks !

Environment info

react-native info output:

System:
    OS: macOS 10.15.5
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Memory: 81.48 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 13.10.1 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.13.7 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK: Not Found
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6392135
    Xcode: 11.5/11E608c - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.2 - /usr/bin/javac
    Python: 2.7.15 - /usr/local/bin/python
  npmPackages:
    @react-native-community/cli: ^2.9.0 => 2.10.0 
    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

  1. Put the app in the background or kill it
  2. Send the notification

Describe what you expected to happen:

  1. A popup appears showing the notification when the app is killed or in the background

Reproducible sample code

build.gradle

  buildscript {
      ext {
         googlePlayServicesVersion = "20.0.0"
         firebaseIidVersion = "20.2.0"
         firebaseMessagingVersion = "20.2.0"
         buildToolsVersion = "28.0.3"
         minSdkVersion = 21
         compileSdkVersion = 28
         targetSdkVersion = 28
         supportLibVersion = "28.0.0"
         ext.kotlinVersion = '1.3.10'
     }
     repositories {
         google()
         jcenter()
         mavenCentral()
         maven {
             url 'https://maven.fabric.io/public'
         }
     }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.3'
        classpath 'com.google.gms:google-services:4.3.3'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
    }
}

app/build.gradle

    implementation 'com.google.firebase:firebase-analytics:17.4.3'
    implementation 'com.google.firebase:firebase-crashlytics:17.0.0'
    implementation 'com.google.firebase:firebase-messaging:20.2.0'
    implementation 'com.google.firebase:firebase-messaging-directboot:20.2.0'

Payload:

 { "notification": { "text": "test",  "title": "title" }, "data": { "dataSample": "sample"}, "priority": "high" }"

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:15

github_iconTop GitHub Comments

1reaction
Dallas62commented, Sep 17, 2020

Hi,

I now recommend you to create channels yourself according to the documentation, and pass the channel when triggering the notification. In the next version, this will not be allowed anymore.

1reaction
Dallas62commented, Jul 1, 2020

Your channel id is wrong, Check #1395 or the README of the dev branch.

Did you mean to write this fixed value? rn-push-notification-channel-id-4-300

Or where can I get my channel id? YOUR-CHANEL-ID-4-300

Yes this is a fixed value such as rn-push-notification-channel-id-4-300

Read more comments on GitHub >

github_iconTop Results From Across the Web

Receive messages in an Android app - Firebase - Google
If you want foregrounded apps to receive notification messages or data messages, you'll need to write code to handle the onMessageReceived callback. For...
Read more >
Notifications Not Shown - Mobile Push
"Delivered" notifications in OneSignal means we have successfully sent the notification to the push servers (FCM/APNS/WNS etc..). These push servers then ...
Read more >
Change notification and quick settings in Windows
In Windows 11, notification center is where you'll find app notifications and quick settings—which give you quick access to commonly used settings and...
Read more >
Notifications Overview | Android Developers
Appearances on a device · Status bar and notification drawer · Heads-up notification · Lock screen · App icon badge · Wear OS...
Read more >
Change Notifications settings on Mac - Apple Support
On your Mac, change how notifications appear in Notification Center and specify when you don't want to be disturbed by notifications.
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found