onmyway133 / PushNotifications

🐉 A macOS, Linux, Windows app to test push notifications on iOS and Android
https://onmyway133.com
Other
2.26k stars 176 forks source link

Is there a way to include apns headers #34

Open michzio opened 4 years ago

michzio commented 4 years ago

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!

Ariandr commented 4 years ago

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

michzio commented 4 years ago

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.

Ariandr commented 4 years ago

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.

ArturRuZ commented 3 years ago

Good day! Is there way to change apns-push-type from "alert" to "background"?

Ariandr commented 3 years ago

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
        }
      }
max-potapov commented 1 year ago

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

Ariandr commented 1 year ago

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.