Slide 1

Slide 1 text

iOS Live Activity

Slide 2

Slide 2 text

QC Li Senior iOS Developer 2020- : Sr. iOS Developer @ LINE (TW) 2018-20: iOS Developer @ Booking.com (NL) 2014-17: Sr. Mobile App Developer @ Yahoo (TW)

Slide 3

Slide 3 text

01 02 03 04 What is Live Activity? All variants of Live Activity UI presentations Challenges during implementing Live Activity Presentations Implementation LINE Shopping App’s experiences Case Study Live Activity CONTENT

Slide 4

Slide 4 text

What is Live Activity? 01 Live Activity

Slide 5

Slide 5 text

Live Activity • View the progress of events or tasks at a glance. • Always on Lock Screen, separated from other push notifications. • Can be created, updated without app alive. • No permission needed in advance.

Slide 6

Slide 6 text

LINE Pay More Live Activities Instagram Uber Eats Maps

Slide 7

Slide 7 text

Supporting OS versions for Live Activity features OS Versions 18.0 Apple Watch 16.1 17.0 17.2 Remote creation iPad Live Activity

Slide 8

Slide 8 text

Devices that support Live Activity Devices 18.0 Apple Watch 16.1 17.0 iPad iPhone Dynamic Island Lock Screen Smart Stack

Slide 9

Slide 9 text

Limitations about Live Activity Restrictions Can NOT access location 8+4 hrs. lifetime Can NOT access network At most 5 Live Activities on a device Payload 4KB

Slide 10

Slide 10 text

Lifecycle Create Update End Create Update End Local Remote • Push Notification permission needed • PushToStartToken needed • iOS 17.2+ • Push Notification permission needed • PushToken needed • Push Notification permission needed • PushToken needed

Slide 11

Slide 11 text

Overview Activity State Visible Update Visible Update Visible Update Visible Update Active Stale Dismissed Ended

Slide 12

Slide 12 text

Active Activity State Visible Update Active Stale Dismissed Ended

Slide 13

Slide 13 text

Stale Activity State Visible Update Active Stale Dismissed Ended

Slide 14

Slide 14 text

Ended Activity State Visible Update Active Stale Dismissed Ended

Slide 15

Slide 15 text

Dismissed Activity State Visible Update Active Stale Dismissed Ended

Slide 16

Slide 16 text

All variants of Live Activity UI presentations 02 Presentations

Slide 17

Slide 17 text

Content (Medium) Presentations Dynamic Island Content (Small)

Slide 18

Slide 18 text

Dynamic Island • Dynamic island is supported on iPhone 14 Pro/Pro Max, all iPhone 15 and 16 models • 3 UI presentations • Compact • Minimal • Expended Compact Minimal Expanded Minimal in Stand By Mode

Slide 19

Slide 19 text

Dynamic Island - Compact

Slide 20

Slide 20 text

Dynamic Island – Minimal

Slide 21

Slide 21 text

Dynamic Island - Expanded There are default margins which can not be removed

Slide 22

Slide 22 text

Content (Medium) • Support on all models of iPhone (iOS 16.1+) and iPad (iOS 17+) • Lock Screen • Notification Center • Banner • For device doesn’t have dynamic island • Alert is set in config • Stand By (iOS 17+)

Slide 23

Slide 23 text

Permission Request UI Note that there will be NO bottom corner radius when requesting permission of Live Activity System UI Live Activity UI

Slide 24

Slide 24 text

Content (Small) • Apple Watch (iOS 18+) • Automatically support • Default style will be used if there is no customization • Smart Stack • Default Style • Dynamic island’s compact leading and trailing Leading Trailing App Name Default Style

Slide 25

Slide 25 text

Recap Presentation\Place Dynamic Island Lock Screen Banner Stand By Smart Stack Dynamic Island (Compact) (default) Dynamic Island (Minimal) Dynamic Island (Expended) (alert) Content (Medium) (alert) Content (Small) (customized)

Slide 26

Slide 26 text

Challenges during implementing Live Activity 03 Implementatio n

Slide 27

Slide 27 text

Define Live Activity • ContentState will be used for update Client

Slide 28

Slide 28 text

Activity Attributes • Needs to be included by both host app and app extension Client ActivityAttributes.swift Host App App Extension (Widget)

Slide 29

Slide 29 text

Define Live Activity UI • All presentations (content, dynamic island) should be defined Client Content Dynamic island Expanded Compact Minimal

Slide 30

Slide 30 text

Activity Families • Use .supplementalActivityFamilies to define supported activity families • .small is for Apple Watch Client iOS 18+

Slide 31

Slide 31 text

Activity Families • Use @Environment(\.activityFamily) to know current activity family in view Client iOS 18+

Slide 32

Slide 32 text

Activity Families • It’s not as simple as I thought • Activity families is only available for iOS 18.0+, but we should support old versions at the same time Client iOS 18+

Slide 33

Slide 33 text

Activity Families • Provide 2 activity configurations could resolve this issue • Extract existing ActivityConfiguration as variable • Use if-else to check OS version Client iOS 18+

Slide 34

Slide 34 text

Activity Families • @Environment(\.activityFamily) has similar issue Client iOS 18+

Slide 35

Slide 35 text

Activity Families • Use similar approach to resolve this issue Client iOS 18+

Slide 36

Slide 36 text

Remote Operations • Start (iOS 17.2+), Update and End • Push Notification permission required • Key file (.p8) required • Call APNs API Server

Slide 37

Slide 37 text

Remote Operations • $DATA is in JSON format Server

Slide 38

Slide 38 text

Remote Operations • $ACTIVITY_PUSH_TOKEN • Start (iOS 17.2+) • Push-to-start token, unique to device • Update, End • Push token, unique to Live Activity instance Server Client

Slide 39

Slide 39 text

Remote Start Flow 1. Request and upload pushToStartToken Server Client

Slide 40

Slide 40 text

Remote Start Flow 2. Start Live Activity from server Server Client

Slide 41

Slide 41 text

Remote Update Flow 1. Request and upload pushToken to server Server Client

Slide 42

Slide 42 text

Remote Update Flow 2. Upload or end Live Activity from server Server Client

Slide 43

Slide 43 text

LINE Shopping App’s experiences 04 Case Study

Slide 44

Slide 44 text

Shop Rebate Count Down Live Activity in LINE Shopping App

Slide 45

Slide 45 text

Issues we met during implementing Live Activity Challenges Existing push services doesn’t support it At most 5 Live Activities on a device Can NOT access network Token upload failed

Slide 46

Slide 46 text

Live Activity can NOT access network Networking Assets needed can not be download from the Internet Pre-download in host app Share within App Group Prepare default assets Issue Solution

Slide 47

Slide 47 text

Push Service Existing push services doesn’t support Live Activity DIY Issue Solution

Slide 48

Slide 48 text

Remote updating relies on push tokens Remote Updating Failure Push tokens upload fails It happens all the time Plan and Design in advance Issue Solution

Slide 49

Slide 49 text

At most 5 Live Activities on a device. Live Activity Count Limitation Can NOT request new Live Activity if reaches the limit Check status when possible Manage it remotely and locally Issue Solution

Slide 50

Slide 50 text

After releasing Live Activity feature 1.5x CVR% than other type of notifications Observations Clicks ++ Orders ++ GMV ++

Slide 51

Slide 51 text

Live Activity New entrance to app Display info user cares about Limitations Variants Recap

Slide 52

Slide 52 text

No content

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

No content