fechanique / cordova-plugin-fcm

Google FCM Push Notifications Cordova Plugin
624 stars 989 forks source link

[Android] onNotification callback not called when app in background or killed #548

Open cayman1066 opened 5 years ago

cayman1066 commented 5 years ago

Problem I am getting notifications in the system's notification tray, but the onNotification callback is never being called when the app is in the background or killed. The app opens when I click on the notification, but the onNotification callback never gets called. It works perfectly when the app is in the foreground.

What I've tried

I'm at a loss for what steps to take next. Any suggestions?

Build

**Ionic:**
   ionic (Ionic CLI)  : 4.1.2 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.0

**Cordova:**
   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.1.1
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.1.4, (and 17 other plugins)

**System:**
   Android SDK Tools : 26.1.1 (/home/mark/Android/Sdk)
   NodeJS            : v9.3.0 (/usr/local/bin/node)
   npm               : 6.4.1
   OS                : Linux 4.12

**Relevant modules:**
cordova-plugin-fcm-with-dependecy-updated@2.2.4
cordova-plugin-local-notification@0.9.0-beta.3
@ionic-native/fcm@4.14.0
@ionic-native/local-notifications@4.14.0
ptsilva commented 5 years ago

Hi @cayman1066, this also happen with me. I tried "click_action":"FCM_PLUGIN_ACTIVITY" and solve the problem.

manzooralam commented 5 years ago

Hi @ptsilva , where this code will write: "click_action":"FCM_PLUGIN_ACTIVITY" my problems was? wasTapped: false (always )

dexterprabhakar commented 5 years ago

hello guys, i have same issue. i added the click action. this has helped in sending the message till FCMPlugin.java file where it is able to identified data.tapped action. but still onNotification(data) js callback is not getting called.

i need to perform action on the data recieved in notification data. any help will be appriciated. Thanks