How Hema Integrated iOS Live Activity & Dynamic Island for 30‑Minute Delivery
This article shares Hema's end‑to‑end technical experience of adopting iOS Live Activity and Dynamic Island for its 30‑minute delivery service, covering timeline, implementation details, challenges, solutions, and future plans for iOS 16.1 features.
Apple introduced Live Activity at WWDC22 to let users see real‑time updates on the lock screen, which aligns well with Hema's fast‑delivery scenario. Hema quickly implemented Live Activity and Dynamic Island in its 30‑minute delivery flow, becoming one of the first iOS apps to support these features and earning an App Store Today recommendation.
The latest version 5.51.1 of the Hema app, which supports Dynamic Island, is now publicly available.
Demo Effect
Rapid Deployment Timeline
June 16 – Preliminary research based on WWDC content.
August 16 – Started demo using official docs and beta.
September 8 – Featured on Apple China website.
September 15 – iOS 16.1 beta released, formal requirement process began.
October 19 – iOS 16.1 RC released, began packaging and regression testing.
October 20 – Submitted for review.
October 22 – Review approved and published.
October 25 – Featured in App Store Today.
Client Technical Solution
Live Activity & Dynamic Island Overview
Before describing Hema's final technical solution, we briefly introduce key findings from our research on Live Activity and Dynamic Island and the scenarios they best fit.
Scenario Limitations & Recommendations
Maximum duration is 8 hours; after that updates stop. After 12 hours the activity disappears, so cross‑day scenarios are not considered.
The activity must be created while the app is in the foreground; it cannot appear automatically when the app is not running.
The card itself cannot perform location or network requests; only a small amount of data (≈4 KB) can be sent via notifications or background activity.
Multiple cards in the same scenario are discouraged because they collapse visually.
Why Adapt Dynamic Island
When a device supports Dynamic Island, Live Activity data is shown there even when the lock screen is not visible.
Without adaptation, tapping the Dynamic Island would simply open the main app and a long‑press would show a blank block.
Hema iPhone 14 Pro/Pro Max users are increasingly common.
Overall Solution Flowchart
Key Points
Live Activity has its own permission, enabled by default without user consent.
Users must keep notification permission enabled for data refresh; background activity does not require it.
Activity must be started while the app is in the foreground.
System automatically animates data updates; custom animations are ignored.
GIFs and remote images are not supported inside the card.
Clickable areas can be configured to open specific pages, similar to widgets.
Technical Challenges & Strategies
Real‑time Update – Notification Refresh
Two update methods were evaluated:
Local update via background tasks (e.g., Bluetooth). Requires the main app process to stay alive.
Notification‑based refresh using a token‑based push payload. This method works without the main app running and provides timely updates, so it was chosen.
Token Reporting
The push token is obtained in Swift via an HTTP request; we pass the token back to the main project using a block, and the main project uploads it.
Image Input – Non‑Local Images
Technical Limitation
Live Activity forbids network images, so the usual server‑side URL approach cannot be used, yet we need order images for personalization.
Solution
iOS 16 beta allowed passing image data (≈4 KB) at creation; iOS 16.1 limits this to ~4 KB, so we opted for built‑in images instead of remote ones.
Device Adaptation – Screen Width
Technical Limitation
UIScreen.main.bounds.width returns 0 on real devices in iOS 16 beta, preventing layout adaptation.
Solution
Pass the screen width as an initial attribute from the main app when creating the Live Activity; this works.
Transition Animation – System Constraints
Custom animations are not allowed; the system handles transitions, which can cause visual issues.
Card Size Transition Issue
Setting a background on the whole view caused mismatched colors during size changes. Switching to a separate layer resolved the problem.
Progress Bar Length Transition Issue
Mask‑based progress bars jumped without animation; using a reversed progress bar achieved a smooth transition.
Analytics – Click Navigation
Default taps open the main app; to navigate to a specific order page we set a custom widgetUrl or use Link. Both can coexist, with Link taking precedence in its area.
Technical Limitation
Analytics cannot be added directly inside the widget; only one widgetUrl is supported when the island is collapsed.
Solution
Append analytics parameters to the URL; the main app parses them. Some events (view, close) remain untrackable.
Version Compatibility – Coexistence with Existing Widget
Hema already has a “Town” widget for iOS 14. Live Activity requires iOS 16.1, so we needed version gating.
Technical Limitation
Xcode 14 beta cannot differentiate versions inside a bundle, requiring a separate extension.
Xcode 14.1 allows version checks inside the same widget extension, but a bug caused both widgets to disappear when used.
Solution
Implement runtime iOS version checks inside the Live Activity widget to hide it on unsupported versions, allowing both widgets to function.
Trigger Conditions – Pre‑checks
Permission Checks
iOS 16.1 or later required.
Notification permission.
Live Activity permission.
If any condition fails, the activity is not created.
Time Limits
Do not create activities for deliveries exceeding 8 hours, as updates stop after that.
Exceptional Scenarios
Maximum number of cards reached – creation fails and no further pushes are sent.
User dismisses the card – the app cannot detect this, so pushes continue silently.
Reminder Fatigue Control
Lock‑Screen Alerts
Live Activity supports silent and alert‑based updates. Alerts trigger lock‑screen illumination and sound, while silent updates only change the island without disturbing the user.
Special Cases
END‑type notifications never trigger an alert, even if the field is set. For devices without Dynamic Island, adding an alert field shows a banner‑style lock‑screen notification that remains on screen until the user interacts.
Extended Capabilities – Field Parsing
Technical Limitation
If the notification payload lacks expected fields, native JSON‑to‑object parsing fails, preventing updates.
Solution
Send the payload as a raw JSON string, parse it into a dictionary, fill missing fields with empty values, and let the widget handle display accordingly.
Future Technical Roadmap
We will continue to monitor user feedback on the 30‑minute delivery scenario, iterating on the experience. We also plan to explore additional iOS features that align with Hema's business, and we welcome iOS enthusiasts to share insights.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
