Onesignal remote Notification Received method not called

Viewed 2322

I want to save notifications in my database so i follow two steps of the document from here https://documentation.onesignal.com/docs/android-native-sdk#notificationserviceextension but remoteNotificationReceived method is not called at all. I used setNotificationWillShowInForegroundHandler like below and it works but I want to receive notifications even when app is in the background

OneSignal.setNotificationWillShowInForegroundHandler(notificationReceivedEvent -> {
        // not called while in background
});

I also should mention that push notification works fine and I get notifications on device

2 Answers

I figure it out by implementing OSRemoteNotificationReceivedHandler in an empty and separate class

Related