Akash khan Akash khan - 3 months ago 138
Javascript Question

Ionic FCM wasTapped always false

I am using Firebase Notification in Ionic framework with cordova fcm plugin. I want to open a state when user received push notification and tapped it. I am sending notification from Firebase console with params but It's always data.wasTapped false that's why it does not work.

if (data.wasTapped) {
//Notification was received on device tray and tapped by the user.
console.log("Tapped: " + JSON.stringify(data));
if (data.hasOwnProperty('state')) {


//if user already opened app
console.log("Not tapped: " + JSON.stringify(data));
}, function(msg) {
console.log('onNotification callback successfully registered: ' + msg);
}, function(err) {
console.log('Error registering onNotification callback: ' + err);


You need to send "click_action":"FCM_PLUGIN_ACTIVITY" in your payload according to cordova-plugin-fcm (https://github.com/fechanique/cordova-plugin-fcm) but in the firebase console there is no scope to send this property. So you have to send it manually.


//POST: https://fcm.googleapis.com/fcm/send
//HEADER: Content-Type: application/json
//HEADER: Authorization: key=AIzaSy*******************
    "title":"Notification title",  //Any value
    "body":"Notification body",  //Any value
    "sound":"default", //If you want notification sound
    "click_action":"FCM_PLUGIN_ACTIVITY",  //Must be present for Android
    "icon":"fcm_push_icon"  //White icon Android resource
    "param1":"value1",  //Any data to be retrieved in the notification callback
    "to":"/topics/topicExample", //Topic or single device
    "priority":"high", //If not set, notification won't be delivered on completely closed iOS app
    "restricted_package_name":"" //Optional. Set for application filtering

In the play store there is an android app I have found to send Firebase Notification. Hopefully this will help you to send Firebase Notification https://play.google.com/store/apps/details?id=com.learn24bd.fcm