iOS 動態通知 (Live Actiivty) 的挑戰與機會
歡迎來到 MOPCON 2024 共筆
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
共筆入口:https://hackmd.io/@mopcon/2024
手機版請點選上方 按鈕展開議程列表。
從這開始
Content
- Live Activity
- Implementation
- Case Study
Live Activity
Intro.
- apple 在 iOS16 的新功能
- 會出現在上面
- demo
Device Support
Smart Stack / Locj Screen / Dynamic Islabd
- iOS 16: iPhone
- iOS 17: iPad
- iOS 18: Apple Watch
Restrictions
- can not access network, location
- at most 5 live activities on a device
- 8+4 hrs, lifetime
- Payload 4KB
create -> Update -> End
- Local: 都可以
- Remote
- create
- push notification permission needed
- PushToStartToken needed
- IOS 17.2+
- Update
- Push Notification permission needed
- PushToken needed
- End
- Push Notification permission needed
- PushToken needed
Activity State
- Active -> 直接滑掉 -> Dismissed (Invisible, can not update)
- Ended: Visible, can not update
UI Presentation
Dynamic Island
3 presentation mode
- Compact Mode
- Minimal
- Expanded
- 長按動態島
- four views: leading, center, bottom, trailing
- iOS 17+ 手機橫放
Content (Medium)
- alert: 自動展開通知
- Permission Request UI
- 是否authorize該App live activitiy
Apple Watch
- iOS 18+
- View: Leading, Trailing
Recap
(table)
Implementation
Define Live Activity
- declare
ActivityAttributes
- needs to be included by both app and its extensions
Define Live Activity UI
- All presentations (content, dynamic island) should be defined
- 可以給空的view, 建議不要
Activity Families
- get state -> return different UI
- iOS 18才有支援,如何同時支援iOS 18之前&之後
- provide 2 activity configurations
- Apple Watch?
Remote Operations
- iOS 17.2+
- push notification permission required
- keey file required
- call APNs API
- 保護好key
- PRIORITY
- ACTIVITY_PUSH_TOKEN
Remote Start Flow
- get
pushToStartToken
, 涉及到網路連線
- 存到 server
- 組出request
- 推播到裝置, live activity
- local or remote 啟動後 -> upload
pushToken
to server
- If user doesn't clikc the activity
- Solution: ??反正要想辦法拿到
Case Study
Line 購物
get line points
time limited line points activity -> Line designed a live activity
Live Activity: time limited
- 商家icon
- push tokens upload fails
- Plan and Design in advance
- Can NOT request new live activity if it reaches the limit
- Checks status when possible Manage it remotely and locally
- 想辦法讓他點進App -> clear some notifications
Live Activity
- new entrance to app
- limitations
- variants