BUG on SDKBox OneSignal -- onNotification(), onNotificationOpened(), onNotification() not working on iOS / Android

Hi there! I need some help…

I’m using OneSignal Plugin to do Push notifications. Everything seems okay except for these listeners that don’t trigger when my app is closed and a notification message is sent from the dashboard.

virtual void onNotification(bool isActive, const std::string& message, const std::string& additionalData) {}
virtual void onNotificationOpened(const std::string &message) {}
virtual void onNotificationReceived(const std::string& message) {}

What I did was to add some in-game logs to check if any of these 3 will be triggered but nothing happens.

I’m using “cocos2d-x 3.15”, and “sdkbox-onesignal_v2.3.16.1”

Btw, when the app is in background or in-game mode, the onNotificationReceived/onNotificationOpened() are triggered properly. Need to make it work when app is closed. I am not sure if I needed to update One Signal or if there’s additional setup I need to do to make this work.

Thank you!

We checked OneSignal’s doc , https://documentation.onesignal.com/docs/notifications-show-successful-but-are-not-being-shown#section-the-app-is-force-stopped .

A closed app can not receive OneSignal’s notification .

The app is Force Stopped

ANDROID
When an app is in a "Force Stopped" state most events including GCM/FCM messages for push notifications will not be received. An app can be placed in this state in the following ways.
- From Settings > Apps, "Force Stop" is pressed.
- Long pressing the back button on some devices.
- Using a 3rd party task killer like Greenify.
- Swiping away your app from the from the recent apps on list on a Xiaomi device.