PushNotifications
PushNotifications copied to clipboard
Is there a way to include apns headers
With watchOS 6 standalone and i think new app there is requirement for
"apns-topic": "#bundle-id" , "apns-push-type": "alert",
I think it should go not into body but into the header. So it will be nice to define header fields!
Hi @michzio
The app sets these headers automatically, both apns-topic
and apns-push-type
.
Without apns-topic
the notifications wouldn't work at all and when you specify bundle id
, you set the header. apns-push-type
was defined starting from iOS 13 and app version 1.7.0+ supports it.
Please, check out the latest stable release if you are using an old version and having any issues with that: https://github.com/onmyway133/PushNotifications/releases
Ok cause I am searching for reason why my standalone watchOS app is not receiving push notifications but through iOS app it is delivered to watch correctly.
Hi @michzio Okay, I see. I will close the issue for now, but if you find something specific, please feel free to create a new issue or reopen this one with additional details.
Good day! Is there way to change apns-push-type from "alert" to "background"?
Hi @ArturRuZ
Now it's set if content-available
== 1 and there are no other fields included in aps
(exception is category
)
.....
.... else if (aps && aps["content-available"] === 1) {
const maxKeysNumber = aps.hasOwnProperty("category") ? 2 : 1
let size = 0, key
for (key in aps) {
size++
}
if (size === maxKeysNumber) {
notification.pushType = "background"
notification.priority = 5
}
}
Hello,
Is it possible to add apns-id
, apns-expiration
, and apns-collapse-id
headers?
Reference: https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html#//apple_ref/doc/uid/TP40008194-CH11-SW1
Hi @max-potapov
You can enter collapse id
from the UI and it's send inside apns-collapse-id
header.
Two others are not available to enter now.