Push notification plugin to receive data without user tap

I am developing an ionic application with push notification.
I tried using FCM plugin.
But observed that in background the data is received in the JS callback when the user taps on the notification.
Our use case is we want the notification data to be received in the JS callback even if the user does not tap on the notification message.
Is there a way to achieve it in FCM plugin (cordova-plugin-fcm-with-dependecy-updated) ?
I tried switching to firebase-messaging plugin as well. But observed similar behavior.
Can anyone please help ?

our notification message:
“to”: “xx”,
“notification”: {
“title”: “Notification title”,
“body”: “Notification body”,
“sound”: “default”,
“click_action”: “FCM_PLUGIN_ACTIVITY”,
“icon”: “fcm_push_icon”
“data”: {
“test”: “code”
}“priority”: “high”

There are two types of push’s: notification and data. (Read this).

You are sending a notification push, so removing the notification body should work. What we do is send both and then implement an app logic that can determinate if data or notification push and if tapped or not and perform stuff based on this. Like this it works for all cases (in foreground, in background, killed and opened via push)

EDIT: Important: DONT set a priority on data push! We had recently some problems an it turns out this was the reason…


Thanks for the response. So every time you will send notification and data message separately ?? Is there any limitation for that approach as the number of messages is increasing?

Every time when i need a push, that is handled in the background running AND also shows a notification. I don’t know any limitations here

You use Firebasex plugin is it ?? Because i saw it in your response for the post “Firebasex plugin for push notification”. Firebasex provides the option to receive data in callback without user tap and also notification in system tray for “data messages with notification keys”. So is there any reason why you send 2 messages everytime ? this info will be very helpful as we are newbie to this area. Thanks in advance

You mean this? https://github.com/dpa99c/cordova-plugin-firebasex#data-message-notifications - Yeah it is exactly this. I can’t really remember, but as we developed our app this feature was not 100% complete or not perfect working for us and we had no time to reimplement yet. I would suggest to test if this is what you need

yes this is the one i mentioned. ok sure we will try testing from our end for this. Thanks a lot for helping out.