pushToStartTokenUpdateStream property

Stream<String> get pushToStartTokenUpdateStream

A stream of push-to-start tokens for iOS 17.2+ Live Activities. This stream emits tokens that can be used to start a Live Activity remotely via push notifications.

When iOS generates or updates a push-to-start token, it will be emitted through this stream. You should send this token to your push notification server to enable remote Live Activity creation.

Example usage:

liveActivities.pushToStartTokenUpdateStream.listen((token) {
  // Send token to your server
  print('Received push-to-start token: $token');
});

This feature is only available on iOS 17.2 and later. Use allowsPushStart to check support.

Implementation

Stream<String> get pushToStartTokenUpdateStream async* {
  final allowed = await allowsPushStart();

  if (!allowed) {
    throw Exception('Push-to-start is not allowed on this device');
  }

  yield* LiveActivitiesPlatform.instance.pushToStartTokenUpdateStream;
}