capacitor-community / fcm

Enable Firebase Cloud Messaging for Capacitor apps
https://capacitor.ionicframework.com/docs/
MIT License
237 stars 83 forks source link

Not receiving any Push notification #66

Closed aabanaag closed 3 years ago

aabanaag commented 3 years ago

Describe the bug I'm not receiving any push notification from console. I got the correct token the one for FCM not the APNS.

To Reproduce Steps to reproduce the behavior: I followed the steps, checked the demo also

Expected behavior Should be able to receive a notif even a log on the console

Screenshots If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

Additional context Ionic:

Ionic CLI : 6.12.3 (/Users/jongbanaag/.config/yarn/global/node_modules/@ionic/cli) Ionic Framework : @ionic/react 5.1.0

Capacitor:

Capacitor CLI : 2.4.2 @capacitor/core : 2.4.2

Utility:

cordova-res : not installed native-run : not installed

System:

NodeJS : v14.15.1 (/Users/jongbanaag/.nvm/versions/node/v14.15.1/bin/node) npm : 6.14.8 OS : macOS Big Sur

Cyral commented 3 years ago

Make sure you have the app closed. I literally spent hours on this when I set up FCM before I realized that push notifications only work if the app is not opened (it can still be running, but the user needs to be in another app or on the homescreen). You can setup notifications to always come through with a setting though I think.

aabanaag commented 3 years ago

what, so the app should be closed?

aabanaag commented 3 years ago

Wow, I tested it and it worked! thanks but is how to configure it to work even if the app is in foreground?

Cyral commented 3 years ago

Honestly I forget what I did, it's been a while. Google around for how to enable push notifications when the app is in the foreground. I think the solution is different for android and ios.

aabanaag commented 3 years ago

ok. Thank you!

aabanaag commented 3 years ago

This is fixed, the issue was I have multiple plugins for local-notifications for some reason if caused conflict which caused the pushNotificationReceived to not trigger.