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.

Pop up notification in active app state not showing.

See original GitHub issue

I am use version 3.3.1, pop up notification if app active not showing but in logs i received notification in console log.

I tried in example is same not showing. Here my android manifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.dski.sample">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.READ_CALENDAR" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.WRITE_CALENDAR" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <application
      android:largeHeap="true"
      android:usesCleartextTraffic="true"
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <meta-data
        android:name="com.google.firebase.messaging.default_notification_icon"
        android:resource="@drawable/ic_stat_notification" />
      <meta-data
        android:name="com.google.firebase.messaging.default_notification_color"
        android:resource="@color/base_color" />
      <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="AIza"/>
      <meta-data 
        android:name="com.facebook.sdk.ApplicationId" 
        android:value="@string/facebook_app_id"/>
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <!--Deep Linking-->
        <intent-filter android:label="@string/app_name">
          <action android:name="android.intent.action.VIEW" />
          <category android:name="android.intent.category.DEFAULT" />
          <category android:name="android.intent.category.BROWSABLE" />
          <data android:scheme="https" android:host="" />
        </intent-filter>
        <!--Deep Linking-->
      </activity>
      <activity
        android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
        android:theme="@style/Base.Theme.AppCompat">
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
      <!-- Notification -->
      <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>

      <meta-data  android:name="com.dieam.reactnativepushnotification.notification_channel_name"
                  android:value="Default"/>
      <meta-data  android:name="com.dieam.reactnativepushnotification.notification_channel_description"
                  android:value="Super channel description"/>
      <meta-data  android:name="com.dieam.reactnativepushnotification.notification_color"
                  android:resource="@android:color/white"/>
      <!-- Notification -->
    </application>

</manifest>

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
HarshitMadhavcommented, Jun 10, 2020

Hi @gibrandev Actually this is the expected behaviour, since notify in foreground may cause duplicate onNotification if the user press it. If you you have a bit of time, feel free to test the dev branch, there is a change to allow this. https://github.com/zo0r/react-native-push-notification/blob/dev/README.md#android-manual-installation

        <!-- 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="false"/>

@Dallas62 Thanks I was struggling so long for this solution. This worked.

0reactions
gibrandevcommented, May 7, 2020
if(!notif.foreground) {
            // Handle foreground click
            if(notif.hasOwnProperty('userInteraction')) {
                if(notif.userInteraction) {

we have add this in my case, and working. Thanks for your help. I always update with this repo. may be my suggestion can realize it 😅

Read more comments on GitHub >

github_iconTop Results From Across the Web

Notifications Not Shown - Mobile Push
Step 3: Settings --> Notification Panel & Status Bar --> Notification Center, select the app, then activate "Allow Notifications" and also "Priority Display"....
Read more >
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 >
App Missing from Settings -> Notifications list - Apple Developer
Went through this forum to ignorer to fix it. I 'Reset all settings' and now all of my apps are not visible in...
Read more >
Notification popup not showing when app at background ...
Remote notification doesn't pop up on Android when app is in background. I did receive the notification at onNotification though. Side note: ...
Read more >
Get push notification while App in foreground iOS
I want to show notification on notification screen independent of whether app is in background or foreground. I am tired by searching for...
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