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.

show_in_foreground is false but banner still showing when app is in foreground

See original GitHub issue

“react”: “16.0.0-alpha.12”, “react-native”: “0.52.1”, “react-native-fcm”: “^14.1.3”

I don’t want to show banner when I push notifications from server. I thought this show_in_foreground would prevent it but it’s still showing when app is in foreground.

For local notification I made:

case NotificationType.WillPresent:
                notif.finish(WillPresentNotificationResult.None)

But for remote notifications this is not enough. How to stop showing banner when in foreground? My use case is to show banner if app is not in foreground and do other things when it is.

This is how I send notification:

{
"to":"xxxxxxxxxxx",
"notification":
{
  "title":"Title", "body":"Description", "sound":"default"},
  "data":{"targetScreen":"details", "show_in_foreground": false},
  "priority":10
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
evollucommented, Apr 19, 2018

@vvusts if you don’t want notification to be shown, use data message?

0reactions
vvustscommented, Apr 19, 2018

@evollu I did that and notification is not showing when app is in foreground. I need to make this also on android. EDIT: It actually work 😃 sorry

Read more comments on GitHub >

github_iconTop Results From Across the Web

Displaying a stock iOS notification banner when your app is ...
But this behavior is seen in Apple's official Messages app: Messages is open and in the foreground. Still shows a notification alert. The...
Read more >
Handling Notifications and Notification-Related Actions
A notification that arrives when your app is running in the foreground. ... Listing 1 shows an example that processes actions associated with...
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 >
SDK Notification Event Handlers - OneSignal Documentation
OneSignal SDK setNotificationWillShowInForegroundHandler method runs before displaying a notification while the app is in focus. Use this handler to decide if ...
Read more >
Mobile Notification Package - Unity Forum
The package is still under development so if you have any feedback or ... Everything is working fine with the app in foreground,...
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