pushy
pushy copied to clipboard
iOS Live Activities
Apple just released Live Activities: https://developer.apple.com/documentation/activitykit/displaying-live-data-on-the-lock-screen-with-live-activities
This will allow servers to send push notifications directly to a live activity (as opposed to the app itself): https://developer.apple.com/documentation/activitykit/activity/pushtoken
I'm still catching up on the documentation, not sure if Pushy will need to support this in any way. It's possible that just using those tokens Pushy will work for this out of the box though.
I spotted this in the docs:
Send push notifications to the Live Activity using the push token you stored on your server. It’s essential that you set the fields for the
content-state
key to match your customActivity.ContentState
type to ensure the system can decode the JSON payload and update the Live Activity.
I can't find any other documentation explaining where that key should be set, though. They do offer an example that makes it look like it should be in the aps
section:
{
"aps": {
"timestamp": 1650998941,
"event": "update",
"content-state": {
"driverName": "Anne Johnson",
"estimatedDeliveryTime": 1659416400
}
}
}
…but I can't find any documented requirements about how it needs to be "shaped." My guess is that the payload docs will get updated shortly. I'll plan to act when there's more concrete information available.
@jchambers I was able to get this to work today with the above payload. The topic is the main apps bundle ID + .push-type.liveactivity
and the push-type is liveactivity
Thanks! At this point, the concern isn't getting it to work so much as being confident that we haven't accidentally baked in some gotchas that we'd need to roll back later. I still think the right move is to wait for the documentation to catch up (it looks like it still hasn't), but I do hope to act on this soon.
@jchambers I was able to get this to work today with the above payload. The topic is the main apps bundle ID +
.push-type.liveactivity
and the push-type isliveactivity
Thanks a lot for sharing, this helped a lot 🙏 Just curious, how did you find out about the postfix for the bundle identifier?
@fxm90 In the console logs I found a statement from APSCourier that listed my apps bundle id with the postfix
Well, the docs still haven't been updated, and it's been more than a month. I think it might be time to just go for it soon.
Just noticed they added some docs - https://developer.apple.com/documentation/activitykit/update-and-end-your-live-activity-with-remote-push-notifications. Doesn't look like the APNS payload docs have been updated yet but at least they have documented the topic and push type.
I started working on Live Activities and needed support for sending push notifications, so I have created a draft PR (#990) with a base implementation for supporting Live Activities based on the few docs that are available, that seems to be working as of iOS 16.1 b2/b3