Foreground messaging and onMessage() onBackgroundMessages() not working
See original GitHub issueI can receive background messages on both Android and iOS. Foreground messages fail on both. I can’t get onMessage() or onBackgroundMessage to trigger. RequestPermission comes back null.
I’ve scanned through all the open and closed issues and tried everything I can find. I want to be able to get foreground messages and also get both types of message observables working.
I wait until platform is ready before initializing.
I’m using requestPermission({forceShow: true})
I’m sending from console.firebases.google in the Cloud Messaging tab
I’ve tried custom data fields with:
content-available=1
content_available=1
contentAvailable=1
Ionic 5.4.16 cordova 9 ios 5.1.1 android 8.1.0 cordova-plugin-ionic-webview 4.1.3 cordova-plugin-firebase-messaging 4.3.1 @ionic-native/firebase-messaging 5.24.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7
@xae217 I’m sending the payload normally in the notification from the backend server. Even, I tried with Firebase console and the callbacks are getting called as well.
I see you have listed ionic dependency so if you are using Ionic, have you wrapped your callback data to
this.ngZone.run(() => {});
?On Ionic Native/ Angular Do =>
Thanks @sagrawal31