'OneSignal - Popup Notifications not showing in Android React Native

I am unable to view Popup Notification on android app created via react-native using OneSignal. I am able to view it in System tray. The eventListener onReceived function of OneSignal is also called and I can see the notification (only in the system tray) and also able to hear the ding sound, but notification popup did not show.

My code where I configure OneSignal in the main container:

OneSignal.init("ONE_SIGNAL_APP_ID");
OneSignal.inFocusDisplaying(2);
OneSignal.addEventListener('ids', (payload) => store.dispatch(Actions.savePushTokenLocal(payload)));
OneSignal.addEventListener('received', (payload) => store.dispatch(Actions.notificationReceived(payload)));
OneSignal.addEventListener('opened', (payload) => store.dispatch(Actions.notificationOpened(payload)));
OneSignal.configure()

I need to be able to view the notification popup when the notification is received, but I am unable to. I have tried almost everything that the documentation has to offer, but all in vain.

Please help me in this.



Solution 1:[1]

Unfortunately at the time of writing this it seems like it there have been issues on this. On the iOS initialization docs (https://documentation.onesignal.com/docs/react-native-sdk) it states "At the present time, none of these settings are available in the Android SDK." which below refers to setting the kOSSettingsKeyInFocusDisplayOption parameter. I assuming this is causing your problem and hopefully available in the future. The best solution may be to set the inFocusDisplaying to 0 and present a custom notification by animating a component into view for a set time when a notification is received. That way you have the ability to customize how the notification displays and behaves.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 JPritchard9518