iOS Live Activities

Discover iOS Live Activities in our Release Notes video

Overview

Live Activities display your appโ€™s most current data on the iPhone or iPad Lock Screen and in the Dynamic Island. This feature allows users to see live information at a glance and perform quick actions related to the displayed information.

Here are a few examples of using Live Activities:

  • Show order status in a delivery app;

  • Provide a real-time countdown in a training app;

  • Show tracking information in a taxi app;

  • Display game stats and current scores in a sports app;

  • Provide hourly forecasts in a weather app.

You can enable Live Activities using the Pushwoosh iOS SDK as described below. To manage Live Activities and update their content, use the /updateLiveActivity method.

Enabling Live Activities

To enable Live Activities, add their code to your existing widget extension or create a new one if your app doesnโ€™t already have it. Live Activities use SwiftUI and WidgetKit functionality for their user interface. ActivityKit handles the life cycle of each Live Activity: its API is used to request, update, and end a Live Activity and to receive ActivityKit push notifications. You can learn more about Live Activities in the Apple documentation.

Pushwoosh enables the management of Live Activities through Push Notifications.

The Pushwoosh iOS SDK provides the following methods for working with Live Activities:

- (void)startLiveActivityWithToken:(NSString * _Nonnull)token;
- (void)startLiveActivityWithToken:(NSString * _Nonnull)token completion:(void (^ _Nullable)(NSError * _Nullable error))completion;

- (void)stopLiveActivity;
- (void)stopLiveActivityWithCompletion:(void (^ _Nullable)(NSError * _Nullable error))completion;

When creating a Live Activity, pass the token to the Pushwoosh server by using the methods below:

- (void)startLiveActivityWithToken:(NSString * _Nonnull)token;
- (void)startLiveActivityWithToken:(NSString * _Nonnull)token completion:(void (^ _Nullable)(NSError * _Nullable error))completion;

When you finish working with a Live Activity, use these methods:

- (void)stopLiveActivity;
- (void)stopLiveActivityWithCompletion:(void (^ _Nullable)(NSError * _Nullable error))completion;

You can manage iOS Live Activities via Pushwoosh API.

Managing Live Activities via Pushwoosh API

You can manage Live Activities and update their content using the /updateLiveActivity method of the Pushwoosh API. For more information, please read this guide:

Last updated