Mobile Development 17 min read

Integrating JD App with HarmonyOS: Hybrid Packaging, Cross‑Platform Interaction, and Feature Ability Development

This guide details how JD adapted its Android app for HarmonyOS using a hybrid packaging approach, covering HarmonyOS features, Android‑to‑Harmony migration steps, inter‑call mechanisms, Feature Ability development, packaging, and publishing for a cross‑device shopping experience.

JD Retail Technology
JD Retail Technology
JD Retail Technology
Integrating JD App with HarmonyOS: Hybrid Packaging, Cross‑Platform Interaction, and Feature Ability Development

Background: With the release of HarmonyOS 2.0, Huawei phones entered the Harmony era, and JD became a partner app, releasing version V10.0.2 for Harmony.

HarmonyOS features: new desktop, swipe‑up shortcuts, atomic capabilities for quick sharing, unified control and service centers, and other user‑experience improvements.

Android project hybridization: To leverage Harmony features without massive rewrites, JD uses a hybrid package development mode, adding a Harmony module while keeping most Android code unchanged.

Steps for Android project conversion:

Add the Harmony compatibility package and extend the Application class from HarmonyApplication .

Modify AndroidManifest.xml to include the compatibility feature and meta‑data: <uses-feature android:name="zidane.software.ability" android:required="false" /> <meta-data android:name="permZA" android:value="true" /> <meta-data android:name="multiFrameworkBundle" android:value="true" />

Configure the entry module’s build.gradle to mix in the original APK: legacyApkOptions{ legacyApk rootProject.file('android_entry.apk').absolutePath // path to mixed apk signConfig{ storeFile rootProject.file('xxx.keystore') } }

Android‑Harmony inter‑call:

From Android to launch a Harmony component, add the Harmony jar and use:

Intent intent = new Intent();
ComponentName componentName = new ComponentName("your harmony app's bundleName name","your ability's full name");
intent.setComponent(componentName);
intent.putExtras(bundle);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TASK);
AbilityUtils.startAbility(context, intent);

From Harmony to start an Android component, add the flag Intent.FLAG_NOT_OHOS_COMPONENT and build the intent accordingly:

Intent intent = new Intent();
Operation operation = new Intent.OperationBuilder()
    .withDeviceId("")
    .withBundleName("your android app’s packagename")
    .withAbilityName("your android app’s activity fullname")
    .withFlags(Intent.FLAG_NOT_OHOS_COMPONENT)
    .build();
intent.setOperation(operation);
startAbility(intent);

Feature Ability (FA) usage: FA enables cross‑device flow, near‑field sharing, and service cards. The article describes development for live‑stream FA, near‑field sharing FA, and search FA, including permission configuration, IDL integration, callback handling, and card lifecycle (create, update, delete).

Packaging and publishing: Build debug or release .hap / .app packages with DevEco or Gradle, install via ADB for testing, and upload the .app file to the Huawei developer center for market release.

Future plan: JD aims to leverage HarmonyOS to create a super‑terminal shopping experience across multiple devices, providing seamless cross‑device interactions and richer user experiences.

mobile developmentcross‑platformHarmonyOSAndroid IntegrationFeature AbilityHybrid Packaging
JD Retail Technology
Written by

JD Retail Technology

Official platform of JD Retail Technology, delivering insightful R&D news and a deep look into the lives and work of technologists.

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.