Is it possible to hide the notification when app is in foreground?
Or show only when app is in backgroud or killed.
in iOS the received notification does not pop up when the App is in foreground, this is done by the OS only when it is in background. If you want to display the notification while he app is running (bad practice) you should do it by yourself.
Sent from my iPhone
Am 13.08.2019 um 13:27 schrieb srednicki95 notifications@github.com:
Is it possible to hide the notification when app is in foreground?
Or show only when app is in backgroud or killed.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
@mitevdev It's automatically popup notification when its get message in notification data. I only tested in Android
I want to show notification only in special case.
My config:
PushNotification.configure({
onNotification: this.onNotification(),
onRegister: this.onDeviceRegister(),
// IOS ONLY
permissions: {
alert: true,
badge: true,
sound: true,
},
popInitialNotification: false,
requestPermissions: true,
// ANDROID ONLY: GCM Sender ID
senderID: GCM_SENDER_ID,
})```
I also trigger my foreground notification by PushNotification.localNotification({data}) and now I have double notifications
I saw in commit: https://github.com/zo0r/react-native-push-notification/commit/a913f84b1d87328e2c445a88d013e74a440378cb?diff=split#diff-ccbd69b1c5564f1a9e6eae125989a510L110
That inForeground flag is now ignored.
Its the only way to handle this is fork?
too bad we have to fork it. it seems like this project is dead now 🙁
Edit: There's also this PR -> #1183
I'm willing to fork this repo and accept or merge some existing PRs if there's a lot of demand.
Hi @srednicki95 , may be you found the solution for prevent android notification to pop when app in foreground? Thanks you)
@lisichka999 Im now using react-native-firebase instead of that. But if you need you can use my forked version of this library.
@srednicki95 Thank you, I found the solution in another post. We also use firebase, but because they does not support remote notifications in v6 we want to give a try to this library.
@srednicki95 Thank you, I found the solution in another post. We also use firebase, but because they does not support remote notifications in v6 we want to give a try to this library.
Can you please share the solution for the same. I am also looking for hiding the notification on android when app is in the foreground.
The easy solution is to use React Native AppState package to detect if app is background or foreground then push notification.
Hi @srednicki95 , may be you found the solution for prevent android notification to pop when app in foreground? Thanks you)
you can send silent notification and display local notification conditionally on the receiver side (it works on Android), but I don't know how it works on IOS
Hi, there is now an option in AndroidManifest to allow/disable foreground notifications.
@Dallas62 Can you give more detail on what option in AndroidManifest can disable foreground notifications? I tried looking at the documentation but did not find anything. Thanks.
Please read the readme AndroidManifest in the "Android Manual Installation".
Regards
Most helpful comment
I saw in commit: https://github.com/zo0r/react-native-push-notification/commit/a913f84b1d87328e2c445a88d013e74a440378cb?diff=split#diff-ccbd69b1c5564f1a9e6eae125989a510L110
That
inForegroundflag is now ignored.Its the only way to handle this is fork?