The notification listener service runs in the background also if your app is closed. It will listen to all notifications and stores them in TinyDB (aka shared preferences) using the name space TaifunNotificationListener .
The Notification Received event fires only if the app is in the foreground.
You can try to use the background extension to read TinyDB regularly and send the data to Firebase