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.

dev branch: Local Notification not showing despite AndroidManifest.xml configuration

See original GitHub issue

Bug

Regression: local notifications don’t work.

The FCM message is received just fine, however even when adding to the AndroidManifest.xml:

<meta-data  android:name="com.dieam.reactnativepushnotification.notification_foreground"
                    android:value="true"/>

the push notification won’t pop up.

This goes even further: I can’t even create local notifications.

Environment info

This was tested with a working app with the minimal setup, which soon after switching repositories the functionality stopped working.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
rarenatoecommented, Jul 21, 2020

@Dallas62 I did test the function PushNotification.localNotification() outside the onNotification bound function with a button press and it did work, so that part is fine I guess.

However it did not work while inside onNotification and most importantly does not show a notification when the app is on the foreground when receiving a remote notification. This is currently working fine in the latest release (4.0.0) through:

<meta-data  android:name="com.dieam.reactnativepushnotification.notification_foreground"
                    android:value="true"/>

When that setting is set to true, one does need to call PushNotification.localNotification() from anywhere, it does it automatically, so I’m not sure what changed.

– EDIT – I managed to fix it with this

 onNotification: function (notification) {
        if(!notification.userInteraction) {
        PushNotification.localNotification({
            id: 0,
            largeIcon: "ic_launcher",
            smallIcon: "ic_notification",
            color: "red",
            vibrate: true,
            vibration: 300,
            channelId: xxxxx,
            onlyAlertOnce: false,
            invokeApp: true,
            title: notification.title,
            message: notification.message,
            playSound: true,
            soundName: "default",
            number: 10,
          });
        }
      },

Originally posted by @abdulbasitha in #1529 (comment)

It seems the issue lies with local push notifications not using the default channel by default (even “rn-push-notification-channel-id-4-default-300”), so instead one must specify them in a second artificially created notification through channelId: xxxxx,.

This seems like broken default behavior.

0reactions
github-actions[bot]commented, Aug 12, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android notification is not showing - Stack Overflow
I have established code. The notification should be working, but for some reason it is not working. The Notification isn't showing at all....
Read more >
Plugin.xml reference documentation - Apache Cordova
xml. Plugin.xml file defines the structure and settings required for your plugin. It has several elements to provide details about your plugin.
Read more >
Introduction to GitLab Flow
Git flow is a well-defined standard, but its complexity introduces two problems. The first problem is that developers must use the develop branch...
Read more >
Android 13 changelog: A deep dive by Mishaal Rahman
This article documents all of the changes we found in Android 13 so developers can prepare their applications or devices while users can...
Read more >
Different Ways to fix “Default Activity Not Found” Issue in ...
This is the most common issue faced by so many developers when creating a new Android Studio Project. This issue occurs because Android ......
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