Mobile Development 12 min read

Trip.com’s HarmonyOS Development Experience: Architecture, Service Card Creation, and Deployment

This article shares Trip.com’s practical experience with HarmonyOS development, covering the system’s distributed architecture, supported languages, service‑card design, native‑WebView integration, configuration files, testing, signing, and future outlook for cross‑device mobile applications.

Ctrip Technology
Ctrip Technology
Ctrip Technology
Trip.com’s HarmonyOS Development Experience: Architecture, Service Card Creation, and Deployment

Background

Trip.com, a leading global travel platform, has been investing in HarmonyOS development since its release, delivering projects such as the ticketing app and service‑card features. The following sections summarize the technical insights gained.

1. HarmonyOS Overview

HarmonyOS (HarmonyOS) is a full‑scene distributed operating system supporting phones, tablets, wearables, and smart screens. It offers a unified IDE, multi‑language compilation, and a distributed Kit that provides visual layout controls, automatic adaptation, and drag‑and‑drop UI components, enabling one‑code‑base multi‑device deployment.

2. HarmonyOS Development

2.1 Development Languages

Supported languages include Java, JavaScript, and C++. Java and JavaScript are used for mobile UI development, while C++ and JavaScript target embedded UI. Future versions (HarmonyOS 3.0) plan to introduce the proprietary Cangjie language, but Java and JavaScript remain the primary choices.

2.2 System Architecture

The architecture follows a layered design: Kernel Layer, System Service Layer, Framework Layer, and Application Layer. It builds on AOSP components for Android compatibility, uses a Kernel Abstract Layer (KAL) to hide kernel differences, and provides distributed soft‑bus communication, multi‑language APIs, and Ability frameworks (FA for UI, PA for background services).

3. Trip.com HarmonyOS Service Cards

3.1 Development Process

The workflow consists of preparation (register as a Huawei developer, install DevEco Studio, configure the environment), coding (create project, write and preview code), testing (apply debugging certificates, perform privacy, security, and performance tests), and publishing (obtain release certificates and submit to Huawei AppGallery).

3.2 Service Card Concept

Service cards are a special Ability UI that surface key information or actions directly on the home screen, reducing navigation depth. Trip.com has implemented cards for membership sign‑in, COVID‑19 testing, and train‑ticket booking.

3.3 Service Card Development

A hybrid approach using HarmonyOS Native + WebView was chosen. The WebView component is declared in XML:

<ohos.agp.components.webengine.WebView ohos:id="$+id:health_webview" ohos:height="match_parent" ohos:width="match_parent"/>

Native code configures the WebView:

private void initWebview() {
WebConfig webConfig = webView.getWebConfig();
if (null != webConfig) {
webConfig.setWebStoragePermit(true);
webConfig.setJavaScriptPermit(true);
webConfig.setSecurityMode(WebConfig.SECURITY_ALLOW);
webConfig.setLocationPermit(true);
webConfig.setDataAbilityPermit(true);
webConfig.setMediaAutoReplay(true);
webConfig.isLoadsImagesPermitted();
webConfig.setTextAutoSizing(true);
webConfig.setViewPortFitScreen(true);
}
setWebViewCookie();
this.webView.setWebAgent(new TripWebAgent());
webView.load(HEALTH_URL);
}

The card’s config.json declares abilities, dimensions, layouts, and update policies, enabling four card sizes (1×2, 2×2, 2×4, 4×4) and automatic updates.

3.4 Testing and Signing

After development, the HAP is signed using DevEco Studio’s automatic signing feature or manually generated .p12/.csr files. The signed app is built, packaged, and uploaded via AppGallery Connect for distribution across devices.

4. Future Outlook

Beyond HarmonyOS, emerging OSes such as Google’s Fuchsia, Apple’s SiriOS, Samsung’s SmartThings, and Tencent’s OS tiny indicate a highly competitive IoT landscape. HarmonyOS’s ecosystem remains early‑stage, with many areas for improvement.

References

1. HarmonyOS Developer Portal 2. HarmonyOS Atomic Service Documentation 3. Service Card Development Guide 4. HarmonyOS Open‑Source Code 5. Articles discussing whether HarmonyOS is an Android skin 6. HarmonyOS real‑device debugging resources

Mobile DevelopmentWebViewHarmonyOSDevEco StudioCross-DeviceService Card
Ctrip Technology
Written by

Ctrip Technology

Official Ctrip Technology account, sharing and discussing growth.

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.