I am making an app which would insert data fetched from FCM payload, into the local SQLite DB on the client mobile.
I am aware "onMessageReceived" will not be called when the app is in background, so I am using putExtra and getStringExtra in my main activity to fetch the payload once the notification is clicked, post which I insert the data into my DB.
However my issue is that, if the user ends up clearing the notification without opening it, he/she will not get the data inserted into his/her local DB.
Is there a way around to ensure, the onMessageReceived is invoked in the background, or any other method where I can implement similar DB insert activities without having the user to either have the app in foreground or explicitly click on the notification for the insert actions to get triggered.