-
-
Notifications
You must be signed in to change notification settings - Fork 120
Open
Description
Hello,
I want to send a LiveActivity start notification. But this is not working.
I use this code to send the notification:
let notification = APNSStartLiveActivityNotification(
expiration: .immediately,
priority: .immediately,
appID: liveActivityAppId,
contentState: drivingState,
timestamp: Int(Date().timeIntervalSince1970),
staleDate: nil,
apnsID: nil,
attributes: DrivingAttributesPayload(id: drivingState.vehicleId, name: drivingState.vehicleName),
attributesType: "DrivingAttributes",
alert: .init()
)
let request = APNSRequest(
message: notification,
deviceToken: deviceToken,
pushType: .liveactivity,
expiration: notification.expiration,
priority: notification.priority,
apnsID: notification.apnsID,
topic: liveActivityTopic,
collapseID: nil
)
return try await apns.client.send(request)
But nothing arrives at the device.
When I use Apples notification console, it is working.
With this Payload:
{"aps":{"timestamp":1765518754,"event":"start","content-state":{"vehicle_id":"1234567890","vehicle_name":"Name"},"alert":{"title":"title","body":"body"},"attributes":{"id":"1234567890","name":"Name"},"attributes-type":"DrivingAttributes"}}
PushToken is certified and it's the same.
liveActivityAppId is the same as in the console.
drivingState is also the same as the content-state in the payload.
liveActivityTopic is same as liveActivityAppId, but with ".push-type.liveactivity"
So, where is my error?
phyllistibbs
Metadata
Metadata
Assignees
Labels
No labels