admin管理员组

文章数量:1394990

I am trying to integrate live activity into my React Native iOS app. I have made the UI, defined necessary attributes, and tested updating live activity using Apple Push Notification Console, which works fine. However, when sending the same payload via Firebase Cloud Messaging (FCM), the live activity does not update, even though FCM reports a successful send.

Below is the payload sent via FCM:

{
    "message": {
        "token": "{fcm token}",
        "notification": {},
        "apns": {
            "headers": {
                "apns-topic": "{app-bundle-id}.push-type.liveactivity",
                "apns-push-type": "liveactivity",
                "apns-priority": "10",
                "apns-expiration": "0"
            },
            "payload": {
                "aps": {
                    "timestamp": 1742974319,
                    "event": "update",
                    "content-state": {
                        "order_progress_info": "{\"title\":\"test\",\"subtitle\":\"subtitle\",\"timestamp\":\"1742974319924\"}"
                    }
                }
            },
            "live_activity_token": "{live activity update token}"
        }
    }
}

I have confirmed:

  • The same token works when sending from Apple Push Notification Console.
  • Normal FCM alerts work fine.
  • I have tried using live_activity_token at the outer level.
  • All required headers are included.

What could be wrong? Any help would be appreciated.

I am trying to integrate live activity into my React Native iOS app. I have made the UI, defined necessary attributes, and tested updating live activity using Apple Push Notification Console, which works fine. However, when sending the same payload via Firebase Cloud Messaging (FCM), the live activity does not update, even though FCM reports a successful send.

Below is the payload sent via FCM:

{
    "message": {
        "token": "{fcm token}",
        "notification": {},
        "apns": {
            "headers": {
                "apns-topic": "{app-bundle-id}.push-type.liveactivity",
                "apns-push-type": "liveactivity",
                "apns-priority": "10",
                "apns-expiration": "0"
            },
            "payload": {
                "aps": {
                    "timestamp": 1742974319,
                    "event": "update",
                    "content-state": {
                        "order_progress_info": "{\"title\":\"test\",\"subtitle\":\"subtitle\",\"timestamp\":\"1742974319924\"}"
                    }
                }
            },
            "live_activity_token": "{live activity update token}"
        }
    }
}

I have confirmed:

  • The same token works when sending from Apple Push Notification Console.
  • Normal FCM alerts work fine.
  • I have tried using live_activity_token at the outer level.
  • All required headers are included.

What could be wrong? Any help would be appreciated.

Share Improve this question edited Mar 27 at 7:52 Aviral Chauhan asked Mar 27 at 7:16 Aviral ChauhanAviral Chauhan 112 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Try changing the timestamp to a future time, about 1 minute ahead. For example, if the current time is 11:58:11, set the timestamp to 11:59:11 (1743656351).

And you need to use the token from pushTokenUpdates to update live activity: for await pushToken in activity.pushTokenUpdates { let token = pushToken.hexadecimalString }

本文标签: swiftUnable to update live activity in my iOS app from FCM (Firebase cloud messaging)Stack Overflow