Does content-available
have to be a first level child of the push data object for notification event handlers to be triggered by phonegap-plugin-push?
If so is there any way to set content-available: 1
as a first level child of the the push data object in notifications from firebase console?
I have created an android app with cordova CLI that uses phonegap-plugin-push and I am using Google Firebase console to send push notifications.
Push notifications work as expected when the app is in the foreground. If the app is not in the in the foreground when the push notification arrives (for example, when the app is opened by clicking the notification on the lock screen) the notification event handlers are never called.
I believe that the cause of the problem is that the content-available: 1
is
inside the additionalData
object.
The only place I see in firebase console to enter content-available
is in the "custom data" field.
This is the push data object received when the app is in the foreground and content-available
is set to 1
in Firebase console > notifications > advanced options > custom data.
data {
title: "message title",
message: "test message 12",
additionalData: {
content-available: "1",
coldstart: false,
collapse_key: "com.domain.appname",
foreground: true
}
}