arnesson / cordova-plugin-firebase

Cordova plugin for Google Firebase
http://arnesson.github.io/cordova-plugin-firebase
MIT License
1k stars 1.55k forks source link

Cordova app not receiving push notification banner when in backgroujd #1123

Open jeremyd125 opened 4 years ago

jeremyd125 commented 4 years ago

Describe the bug I have gone through the process to implement push notifications through firebase in my cordova app including:

Specifically for this plugin I run the following methods on init of the app:

window.FirebasePlugin.getToken(function (token) {
  db.collection('users').doc(userID).update({
    deviceTokens: firebase.firestore.FieldValue.arrayUnion(token)
  })
  commit('saveDeviceToken', token)
}, function (error) {
  alert(error)
})`

window.FirebasePlugin.onNotificationOpen(function (notification) { alert(notification) }, function (error) { alert(error) })`

I'm working on IOS 12.

I can receive notifications when the app is in the foreground, however when the app is in the background or killed, no banner appears on my phone & I receive no push notification.

This is the firebase payload I'm using to send the notification: `{ "to": ***", "priority": "high", "data": { "title": "hi", "body": "hi" }, "notification": { "title": "hi", "body": "hi", "sound": "default", "click_action": "FCM_PLUGIN_ACTIVITY", "icon": "fcm_push_icon", "content_available": true, "apnsPushType": "alert" }, "apns": { "headers": { "apns-push-type": "alert", "apns-priority": 10, "apns-topic": "org.benchmark.app",

    },
    "payload": {
        "alert": {
            "title": "hi",
            "body": "hi"
        },
        "content_available": 1
    },

}

}`

Can y'all help me understand is this a problem with my apple/firebase configuration or is there something I have to do with this plugin to register for those banner notifications?

Expected behavior Receive a push notifications with banner & alert when app is in the background

Plugin Version

2.0.5