Skip to content

Commit 9c0413a

Browse files
anna1901kowczarz
andauthored
Small README updates (#29)
* Update README.md Co-authored-by: Kamil Owczarz <91068263+kowczarz@users.noreply.github.com> --------- Co-authored-by: Kamil Owczarz <91068263+kowczarz@users.noreply.github.com>
1 parent c1d4c87 commit 9c0413a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ The `config` object should include:
114114
## Example Usage
115115
Managing a live activity:
116116
```javascript
117-
const state = {
117+
const state: LiveActivity.LiveActivityState = {
118118
title: "Title",
119119
subtitle: "This is a subtitle",
120120
date: new Date(Date.now() + 60 * 1000 * 5).getTime(),
121121
imageName: "live_activity_image",
122122
dynamicIslandImageName: "dynamic_island_image"
123123
};
124124

125-
const config = {
125+
const config: LiveActivity.LiveActivityConfig = {
126126
backgroundColor: "#FFFFFF",
127127
titleColor: "#000000",
128128
subtitleColor: "#333333",
@@ -147,9 +147,13 @@ useEffect(() => {
147147
// Send token to a remote server to update live activity with push notifications
148148
});
149149

150-
return () => subscription.remove();
150+
return () => subscription?.remove();
151151
}, []);
152152
```
153+
154+
> [!NOTE]
155+
> Receiving push token may not work on simulators. Make sure to use physical device when testing this functionality.
156+
153157
## Push notifications
154158
By default, updating live activity is possible only via API. If you want to have possibility to update live activity using push notifications, you can enable that feature by adding `"enablePushNotifications": true` in the plugin config in your `app.json` or `app.config.ts` file. Then, the notification payload should look like this:
155159

0 commit comments

Comments
 (0)