Open hanslbua opened 2 years ago
I am having similar issue and not able to understand what to extend in order to support background notification so that It can trigger pushNotificationReceived
https://github.com/ionic-team/capacitor-plugins/issues/964#issuecomment-1125290371
Having the same issue, but with localNotifications and background tasks
This may be a bit late, but you can extend the FirebaseMessagingService
on Android pretty easily. This is a good starting point. The main idea is:
extends FirebaseMessagingService
onMessageRecieved
in that serviceAs far as I know, that should about do it. Problem is, that service extension doesn't seem to work while the Cap push plugin is listening to the same event; at least I can't get it working. Have a look here: https://github.com/ionic-team/capacitor-plugins/issues/1211 The code examples I've posted in the original issue should help you get started.
Heads up: the issue I was talking about is non-existent. There was an oversight in the Firebase documentation, which has been rectified. You're good to go.
Is there a working solution posted anywhere?
Is there a working solution posted anywhere?
See my comment above. I could pull it off without ever having used Java before, so you'll probably be just fine.
Bug Report
Plugin(s)
@capacitor/push-notifications
Capacitor Version
Capacitor Doctor
Latest Dependencies:
@capacitor/cli: 3.5.1
@capacitor/core: 3.5.1
@capacitor/android: 3.5.1 @capacitor/ios: 3.5.1
Installed Dependencies:
@capacitor/cli: 3.4.3 @capacitor/android: 3.4.3 @capacitor/core: 3.4.3 @capacitor/ios: 3.3.3
[success] Android looking great! 👌
Platform(s)
Android
Current Behavior
hello. i have a question. is use @capacitor/push-notifications for push notifications. on ios everything works as expected, but on android i get only notifications, when the app is in foreground. when the app is in background or killed i dont get any push notification from firebase. firebase seems to be right configured, because it works in foreground + on ios.
i read this on npm site: This plugin does support data-only notifications, but will NOT call pushNotificationReceived if the app has been killed. To handle this scenario, you will need to create a service that extends FirebaseMessagingService, see Handling FCM Messages.
can someone help me, getting push notification also when my app is in background or killed?