קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
HTTP v1 API של Firebase Cloud Messaging מאפשר לשלוח, לעדכן ולסיים מרחוק התראות על פעילות בשידור חי במכשירי iOS. שימו לב שצריך iOS 16.1 כדי להשתמש בפעילות בשידור חי, ו-iOS 17.2 כדי להפעיל מרחוק התראה על פעילות בשידור חי.
כדי להתחיל פעילות בזמן אמת מרחוק באמצעות Firebase Cloud Messaging, צריך לקבל מאפל אסימון של push-to-start. תצטרכו גם את FCM טוקן הרישום של אפליקציית היעד.
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-09-03 (שעון UTC)."],[],[],null,["\u003cbr /\u003e\n\nWith the Firebase Cloud Messaging [HTTP v1\nAPI](/docs/reference/fcm/rest/v1/projects.messages/send), you can remotely send,\nupdate, and end live activity notifications on iOS devices. Note that you need\niOS 16.1 to use live activity and iOS 17.2 to remotely start a live activity\nnotification.\n\nBefore you begin\n\nBefore you get started with live activity on Firebase Cloud Messaging, follow the\ninstructions in [Set up a Firebase Cloud Messaging client app on Apple\nplatforms](/docs/cloud-messaging/ios/client) to create and add\nFirebase Cloud Messaging to your client app.\n\nStart a live activity\n\nTo start a live activity remotely using Firebase Cloud Messaging, you need to\nobtain a [push-to-start\ntoken](https://developer.apple.com/documentation/activitykit/starting-and-updating-live-activities-with-activitykit-push-notifications#Start-new-Live-Activities-with-ActivityKit-push-notifications)\nfrom Apple. You will also need the [FCM registration\ntoken](/docs/cloud-messaging/ios/client#access_the_registration_token) for the\ntarget app.\n\nTo construct a [payload that starts a live\nactivity](https://developer.apple.com/documentation/activitykit/starting-and-updating-live-activities-with-activitykit-push-notifications#Construct-the-payload-that-starts-a-Live-Activity),\nfill in the\n[`apns.payload`](/docs/reference/fcm/rest/v1/projects.messages#ApnsConfig) field\nfrom the following code sample to remotely start a live activity using\nFCM. You can use the [API\nExplorer](/docs/reference/fcm/rest/v1/projects.messages/send?apix=true&apix_params=%7B%22parent%22%3A%22projects%2F%3Cproject_number%3E%22%2C%22resource%22%3A%7B%22message%22%3A%7B%22token%22%3A%22%3Cfcm_token%3Atest%3E%22%2C%22apns%22%3A%7B%22live_activity_token%22%3A%22%3Clive_activity_push_to_start_token%3E%22%2C%22headers%22%3A%7B%22apns-priority%22%3A%2210%22%7D%2C%22payload%22%3A%7B%22aps%22%3A%7B%22timestamp%22%3A%22%3Ctimestamp%3E%22%2C%22event%22%3A%22start%22%2C%22content-state%22%3A%7B%22demo%22%3A1%7D%2C%22attributes-type%22%3A%22DemoAttributes%22%2C%22attributes%22%3A%7B%22demoAttribute%22%3A1%7D%2C%22alert%22%3A%7B%22title%22%3A%22test%20title%22%2C%22body%22%3A%22test%20body%22%7D%7D%7D%7D%7D%7D%7D)\nto construct and test your payload. \n\n```gdscript\n\"message\":{\n \"token\": \"\u003cfcm_token:test\u003e\",\n \"apns\":{\n \"live_activity_token\": \"\u003clive_activity_push_to_start_token\u003e\",\n \"headers\":{\n \"apns-priority\": \"10\"\n },\n \"payload\":{\n \"aps\": {\n \"timestamp\": \u003ctimestamp\u003e,\n \"event\": \"start\",\n \"content-state\": {\n \"demo\": 1\n },\n \"attributes-type\": \"DemoAttributes\",\n \"attributes\": {\n \"demoAttribute\": 1,\n },\n \"alert\": {\n \"title\": \"test title\",\n \"body\": \"test body\"\n }\n }\n }\n }\n }\n```\n\nUpdate a live activity\n\nTo update a live activity remotely using Firebase Cloud Messaging, you need to\nobtain a [push\ntoken](https://developer.apple.com/documentation/activitykit/starting-and-updating-live-activities-with-activitykit-push-notifications#Start-a-Live-Activity-that-supports-push-updates-to-push-tokens)\nfrom Apple. You will also need the [FCM registration\ntoken](/docs/cloud-messaging/ios/client#access_the_registration_token) for the\ntarget app.\n\nTo construct a [payload that updates a Live\nActivity](https://developer.apple.com/documentation/activitykit/starting-and-updating-live-activities-with-activitykit-push-notifications#Construct-the-ActivityKit-remote-push-notification-payload),\nfill in the\n[`apns.payload`](/docs/reference/fcm/rest/v1/projects.messages#ApnsConfig) field\nfrom the following code sample to remotely update a live activity using\nFCM. You can use the [API\nExplorer](/docs/reference/fcm/rest/v1/projects.messages/send?apix=true&apix_params=%7B%22parent%22%3A%22projects%2F%3Cproject_number%3E%22%2C%22resource%22%3A%7B%22message%22%3A%7B%22token%22%3A%22%3Cfcm_token%3Atest%3E%22%2C%22apns%22%3A%7B%22live_activity_token%22%3A%22%3Clive_activity_push_token%3E%22%2C%22headers%22%3A%7B%22apns-priority%22%3A%2210%22%7D%2C%22payload%22%3A%7B%22aps%22%3A%7B%22timestamp%22%3A%22%3Ctimestamp%3E%22%2C%22event%22%3A%22update%22%2C%22content-state%22%3A%7B%22test1%22%3A100%2C%22test2%22%3A%22demo%22%7D%2C%22alert%22%3A%7B%22title%22%3A%22test%20title%22%2C%22body%22%3A%22test%20body%22%7D%7D%7D%7D%7D%7D%7D)\nto construct and test your payload. \n\n```gdscript\n\"message\":{\n \"token\": \"\u003cfcm_token:test\u003e\",\n \"apns\":{\n \"live_activity_token\": \"\u003clive_activity_push_token\u003e\",\n \"headers\":{\n \"apns-priority\": \"10\"\n },\n \"payload\":{\n \"aps\": {\n \"timestamp\": \u003ctimestamp\u003e,\n \"event\": \"update\",\n \"content-state\": {\n \"test1\": 100,\n \"test2\": \"demo\"\n },\n \"alert\": {\n \"title\": \"test title\",\n \"body\": \"test body\"\n }\n }\n }\n }\n }\n}\n```\n\nEnd a live activity\n\nTo end a live activity using Firebase Cloud Messaging, you need to obtain a [push\ntoken](https://developer.apple.com/documentation/activitykit/starting-and-updating-live-activities-with-activitykit-push-notifications#Start-a-Live-Activity-that-supports-push-updates-to-push-tokens)\nfrom Apple. You will also need the [FCM registration\ntoken](/docs/cloud-messaging/ios/client#access_the_registration_token)\nfor the target app.\n\nTo construct [a payload that ends a live\nactivity](https://developer.apple.com/documentation/activitykit/starting-and-updating-live-activities-with-activitykit-push-notifications#Construct-the-ActivityKit-remote-push-notification-payload),\nfill in the\n[`apns.payload`](/docs/reference/fcm/rest/v1/projects.messages#ApnsConfig) field\nfrom the following code sample to remotely end a live activity using\nFCM. You can use the [API\nExplorer](/docs/reference/fcm/rest/v1/projects.messages/send?apix=true&apix_params=%7B%22parent%22%3A%22projects%2F%3Cproject_number%3E%22%2C%22resource%22%3A%7B%22message%22%3A%7B%22token%22%3A%22%3Cfcm_token%3Atest%3E%22%2C%22apns%22%3A%7B%22live_activity_token%22%3A%22%3Clive_activity_push_token%3E%22%2C%22headers%22%3A%7B%22apns-priority%22%3A%2210%22%7D%2C%22payload%22%3A%7B%22aps%22%3A%7B%22timestamp%22%3A%22%3Ctimestamp%3E%22%2C%22dismissal-date%22%3A%22%3Cdismissal_date%3E%22%2C%22event%22%3A%22end%22%2C%22content-state%22%3A%7B%22test1%22%3A100%2C%22test2%22%3A%22demo%22%7D%2C%22alert%22%3A%7B%22title%22%3A%22test%20title%22%2C%22body%22%3A%22test%20body%22%7D%7D%7D%7D%7D%7D%7D)\nto construct and test your payload. \n\n```gdscript\n\"message\":{\n \"token\": \"\u003cfcm_token:test\u003e\",\n \"apns\":{\n \"live_activity_token\": \"\u003clive_activity_push_token\u003e\",\n \"headers\":{\n \"apns-priority\": \"10\"\n },\n \"payload\":{\n \"aps\": {\n \"timestamp\": \u003ctimestamp\u003e,\n \"dismissal-date\": \u003cdismissal_date\u003e,\n \"event\": \"end\",\n \"content-state\": {\n \"test1\": 100,\n \"test2\": \"demo\"\n },\n \"alert\": {\n \"title\": \"test title\",\n \"body\": \"test body\"\n }\n }\n }\n }\n }\n}\n```"]]