Mobile Development 14 min read

How Alipay Leverages HarmonyOS 4.0 Real‑Time Activity for Smart Medical Alerts

This article explains how Alipay integrates HarmonyOS 4.0 real‑time activity notifications to provide intelligent medical reminders, detailing the UI forms, cross‑team data flow, communication protocols, code integration, optimization challenges, and future scenario expansions.

Alipay Experience Technology
Alipay Experience Technology
Alipay Experience Technology
How Alipay Leverages HarmonyOS 4.0 Real‑Time Activity for Smart Medical Alerts

1. Topic Background

On August 4, Huawei unveiled HarmonyOS 4.0 at HDC, emphasizing personalization and diversity. During the feature showcase, Alipay demonstrated a new capability built on HarmonyOS 4.0 that appears in the conference slides.

The feature looks like a system notification but differs significantly; Huawei calls it a real‑time activity or live notification.

It is likened to a domestic “Dynamic Island” because its capsule form closely resembles iOS’s Dynamic Island UI, while also supporting richer display positions such as screen‑off, lock screen, desktop, notification bar, and notification center.

2. Result Display

Alipay version 10.5.10 already supports HarmonyOS real‑time activity, initially applied to medical scenarios with plans to expand.

Notification Bar : left side shows a normal real‑time activity card; right side allows user actions like settings and deletion.

Desktop Capsule : left shows capsule text on the top‑left corner; tapping expands the notification card; right side supports further actions after expansion.

Lock Screen : displays the notification card when the power button is pressed.

Screen‑off Capsule : shows capsule text on the screen‑off interface.

Beyond text‑emphasis templates, Huawei also offers progress‑visualization templates for ride‑hailing, food delivery, and sports score templates for events.

3. Implementation Details

Real‑time activity is essentially an extended Android notification. HarmonyOS parses extra parameters to create and populate templates. Third‑party apps only need to follow the interface protocol and template parameters; no UI rendering is required.

3.1 Processing Chain

Three teams cooperate:

Client Team : receives sync messages, creates live notifications, and sends card and token info to the Message Platform and Push teams.

Message Platform Server Team : queries user orders, pushes data downstream via sync, and receives card info from the client.

Push Team : receives token info, forwards updated card data to the vendor cloud, which updates or deletes the notification card.

Data flow diagrams (images omitted) illustrate that the client only creates the card; subsequent updates are handled by the vendor cloud.

3.2 Communication Protocol

Two protocols are defined:

In‑app protocol: messages flow from the Message Platform to the client, which creates the card and reports updates to the Push platform.

Out‑of‑app protocol: the Push platform forwards updates to the vendor cloud, which then pushes them to the device.

The protocols support both card creation and update lifecycles.

3.2.1 In‑app Protocol

The protocol extends the iOS Dynamic Island protocol used by Alipay, reusing existing fields and adding required ones for Huawei real‑time activity, following a maximal compatibility principle.

3.2.2 Out‑of‑app Protocol

The Push team translates the in‑app fields into vendor‑specific requests, forming a three‑tuple parameter set for updates.

3.3 Code Integration

3.3.1 Creating the Card

<code>// Create bundle to hold notification data, set type to 4 for emphasized text template
Bundle liveNotificationData = new Bundle();
liveNotificationData.putInt("XXXX", 0);
liveNotificationData.putString("XXXX", "Other");
liveNotificationData.putInt("XXXX", 4);
// Create bundle for emphasized text template parameters
Bundle feature = new Bundle();
feature.putString("XXXX", "取餐码");
feature.putString("XXXX", "750");
liveNotificationData.putBundle("XXXX", feature);
// Build notification and add extras
Notification notification = new Notification.Builder(context, channelId)
    .addExtras(liveNotificationData)
    .build();</code>

3.3.2 Extending the Capsule

<code>// Create bundle for capsule parameters
Bundle capsule = new Bundle();
capsule.putInt("XXXX", 1);
capsule.putInt("XXXX", 1);
capsule.putParcelable("XXXX", Icon.createWithResource(context, R.drawable.xxx));
capsule.putInt("XXXX", Color.parseColor("#FFFF0000"));
capsule.putString("XXXX", "胶囊标题");
capsule.putString("XXXX", "胶囊扩展内容");
// Attach capsule to live notification data
liveNotificationData.putBundle("XXXX", capsule);
</code>

4. Continuous Optimization

Two main issues remain:

Vendor push update reliability is not 100 %; about 8 % of updates are lost.

Multiple teams request the device PushToken, but Huawei limits request frequency, causing occasional token acquisition failures.

4.1 Client‑Side Updates

When vendor push fails, Alipay retains a client‑side update mechanism that proactively requests data from the Message Platform and performs overlay updates.

4.2 PushToken Reuse

To avoid token contention, the Push team consolidates token requests; if the real‑time activity has not reported a token, it reuses tokens uploaded by other business modules.

5. Scenario Coverage

Currently only the medical scenario is live, displaying hospital name, appointment time, and progress. Future plans include expanding to audio playback, ride‑hailing, high‑speed rail, flight, and sports event score templates.

6. Future Outlook

The existing architecture supports rapid onboarding of new business scenarios, with template types ranging from basic audio progress to complex scoreboards for sports events.

AndroidHarmonyOSalipayMobile NotificationsMedical AlertsReal-time Activity
Alipay Experience Technology
Written by

Alipay Experience Technology

Exploring ultimate user experience and best engineering practices

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.