Get started with Live Activity

With the Firebase Cloud Messaging HTTP v1 API, you can remotely send, update, and end live activity notifications on iOS devices. Note that you need iOS 16.1 to use live activity and iOS 17.2 to remotely start a live activity notification.

Before you begin

Before you get started with live activity on Firebase Cloud Messaging, follow the instructions in Set up a Firebase Cloud Messaging client app on Apple platforms to create and add Firebase Cloud Messaging to your client app.

Start a live activity

To start a live activity remotely using Firebase Cloud Messaging, you need to obtain a push-to-start token from Apple. You will also need the FCM registration token for the target app.

To construct a payload that starts a live activity, fill in the apns.payload field from the following code sample to remotely start a live activity using FCM. You can use the API Explorer to construct and test your payload.

"message":{
    "token": "<fcm_token:test>",
    "apns":{
      "live_activity_token": "<live_activity_push_to_start_token>",
      "headers":{
        "apns-priority": "10"
      },
      "payload":{
        "aps": {
          "timestamp": <timestamp>,
          "event": "start",
          "content-state": {
            "demo": 1
          },
          "attributes-type": "DemoAttributes",
          "attributes": {
            "demoAttribute": 1,
          },
          "alert": {
            "title": "test title",
            "body": "test body"
          }
        }
      }
    }
  }

Update a live activity

To update a live activity remotely using Firebase Cloud Messaging, you need to obtain a push token from Apple. You will also need the FCM registration token for the target app.

To construct a payload that updates a Live Activity, fill in the apns.payload field from the following code sample to remotely update a live activity using FCM. You can use the API Explorer to construct and test your payload.

"message":{
    "token": "<fcm_token:test>",
    "apns":{
      "live_activity_token": "<live_activity_push_token>",
      "headers":{
        "apns-priority": "10"
      },
      "payload":{
        "aps": {
          "timestamp": <timestamp>,
          "event": "update",
          "content-state": {
            "test1": 100,
            "test2": "demo"
          },
          "alert": {
            "title": "test title",
            "body": "test body"
          }
        }
      }
    }
  }
}

End a live activity

To end a live activity using Firebase Cloud Messaging, you need to obtain a push token from Apple. You will also need the FCM registration token for the target app.

To construct a payload that ends a live activity, fill in the apns.payload field from the following code sample to remotely end a live activity using FCM. You can use the API Explorer to construct and test your payload.

"message":{
     "token": "<fcm_token:test>",
    "apns":{
      "live_activity_token": "<live_activity_push_token>",
      "headers":{
        "apns-priority": "10"
      },
      "payload":{
        "aps": {
          "timestamp": <timestamp>,
          "dismissal-date": <dismissal_date>,
          "event": "end",
          "content-state": {
            "test1": 100,
            "test2": "demo"
          },
          "alert": {
            "title": "test title",
            "body": "test body"
          }
        }
      }
    }
  }
}