Question:
How do I control whether a notification banner is shown while my React Native app is in the foreground?
Answer:
iOS. The behaviour is controlled by the Pushwoosh_SHOW_ALERT boolean key in your app's Info.plist (not from JavaScript):
<key>Pushwoosh_SHOW_ALERT</key>
<true/> <!-- or <false/> -->
- true (default) - the system alert/banner is shown when a push arrives while the app is in the foreground;
-
false - the native foreground alert is suppressed. Use this if you want to render your own UI: handle the
pushReceivedevent in JavaScript, or use the nativePushwooshForegroundPushmodule for a customised foreground notification.
Android. There is no Pushwoosh_SHOW_ALERT equivalent - a push received in the foreground is posted to the notification drawer by default. Use the pushReceived event if you want to react in-app instead, or a custom Notification Factory to change how the notification is built.
In both cases pushReceived fires as soon as the push arrives (foreground included), while pushOpened fires only when the user taps the notification.
See the React Native plugin guide and iOS custom foreground push notification for details.
Comments
0 comments
Please sign in to leave a comment.