Mobile Development 11 min read

Unlocking HarmonyOS NEXT Intent Framework: Boost User Experience and Drive Growth

This article explains HarmonyOS NEXT's Intent Framework, detailing its distribution capabilities, real‑world usage scenarios—including finance examples—along with step‑by‑step integration, code snippets, testing procedures, and future enhancements to improve mobile app engagement.

JD Cloud Developers
JD Cloud Developers
JD Cloud Developers
Unlocking HarmonyOS NEXT Intent Framework: Boost User Experience and Drive Growth

Intent Framework Service Overview

HarmonyOS NEXT introduces an Intent Framework that intelligently distributes application business functions to system entry points such as XiaoYi Dialogue, XiaoYi Search, and XiaoYi Suggestion. This enables proactive user searches, AI‑driven recommendations, and personalized suggestions, enhancing user experience, creating new traffic growth points, and supporting app increment.

Distribution Capabilities

Habit Recommendation – XiaoYi Suggestion : Apps register intents; the system learns user habits and recommends relevant business content at appropriate times, delivering a more personalized experience.

Event Recommendation – XiaoYi Suggestion : The system extracts intent‑related events and, based on time, location, etc., pushes reminder services (e.g., arrival at a place or specific time).

Skill Invocation – XiaoYi Dialogue : Leveraging AI large models, the system understands natural language input and invokes corresponding app or meta‑service functions, simplifying operations.

Local Search – XiaoYi Search : A local index is built for registered intents; users can retrieve relevant in‑app content by entering keywords, greatly improving search efficiency.

Usage Scenarios

Common Scenarios

The system can share a user's movie ticket order, extracting key features (time, location) and proactively pushing a viewing reminder via XiaoYi Suggestion.

When a user asks “How much is a flight from Shenzhen to Beijing?” in XiaoYi Dialogue, the system understands the intent, calls the flight‑search function, and presents relevant flight information.

Financial Vertical Scenarios (JD Finance)

The following five intents were piloted for JD Finance:

Query JD Consumption Details : Opens the JD Finance bill detail page, allowing users to view transaction specifics.

Query JD Baitiao Bill : Opens the JD Baitiao bill page, helping users check amounts and due dates to avoid overdue payments.

Repay JD Baitiao : Directly opens the repayment page, streamlining the repayment process.

Recommend JD Finance Products : Based on user financial status and investment preferences, the system suggests suitable wealth‑management products.

View Newly Listed Stocks : Opens the new‑stock calendar, providing listing dates and company backgrounds to help users seize investment opportunities.

Intent Runtime Logic

Applications or meta‑services can proactively share intents with HarmonyOS, enabling the system to build local content indexes and learn user behavior. Users can trigger intents either by entering information at system entry points or through proactive recommendations, allowing the OS to predict needs and deliver personalized, intelligent services.

Basic Integration Process

1. Choose Feature and Define Intent

Communicate with Huawei to define the intent interface, register the intent, and implement intent handling. Users interact via natural language in XiaoYi Dialogue, which the system translates into intent calls with parameters.

2. Device‑Side Intent Registration

Create insight_intent.json under PROJECT_HOME/entry/src/main/resources/base/profile/ with content such as:

{
  "insightIntents":[
    {
      "intentName":"xxxx",
      "domain":"BankingDomain",
      "intentVersion":"1.0.1",
      "srcEntry":"./ets/insightintents/IntentExecutorImpl.ets",
      "uiAbility":{
        "ability":"MainUIAbility",
        "executeMode":["foreground"]
      }
    }
  ]
}

3. Implement Intent Execution

Create IntentExecutorImpl.ets at PROJECT_HOME/entry/src/main/ets/insightintents/ with a class extending InsightIntentExecutor:

export default class IntentExecutor extends InsightIntentExecutor {
  /**
   * Execute UIAbility intent in foreground mode
   */
  async onExecuteInUIAbilityForegroundMode(intentName:string, intentParam: Record<string, Object>,
    pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult>{
    // Dispatch handling logic based on intent name
    switch(intentName){
      case DispatchTools.xxx:
        return this.viewAccountChange(intentParam, pageLoader);
      // ... other cases ...
      default:
        console.error('invalid intent name', intentName);
        let result: insightIntent.ExecuteResult = {
          code: -1,
          result:{
            "error":"invalid intent name",
            "intentName": intentName
          }
        };
        return result;
    }
  }

  private viewAccountChange(param: Record<string, Object>, pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult>{
    return new Promise((resolve, reject) => {
      resolve({
        code: 0,
        result:{
          message:'Intent execute succeed'
        }
      });
    });
  }
}

4. Open Specific Pages

dispatchAI(want: Want | undefined){
  try{
    if(want && want.parameters){
      let url:string|undefined;
      let bid:string|undefined;
      let name = want?.parameters['ohos.insightIntent.executeParam.name'] as string;
      let param = want.parameters['ohos.insightIntent.executeParam.param'] as Record<string, Object>;
      switch(name){
        case DispatchTools.PAY_REPAYMENT:
          url = DispatchTools.xxx;
          bid = DispatchTools.xxx;
          break;
        // ... other cases ...
      }
      if(url && !PageMatchUtil.matchPath(url,false)){
        jrouter.navigation(url);
      }
    }
  }catch(e){
    // handle error
  }
}

Note: When opening the same page multiple times, add checks to prevent duplicate displays.

5. Verify Integration Success

Use the provided testing tool (NEXT 66 beta1 supports it) and input a JSON payload such as:

{
  "bundleName":"com.jd.xxx",
  "executeMode":"foreground",
  "intentName":"xxx",
  "intentParam":{
    "entityId":"C10194368",
    "cardTailNumber":"1234",
    "cardType":"CreditCard",
    "timeInterval":[163739320000,163739320000]
  }
}

6. Platform Registration

After the app is officially released, register the intent via AppGallery > Management Center > Ecosystem Services > Smart Services > XiaoYi Open Platform. Drafts are created automatically; simply fill in intent details and save.

Future Outlook

To further enhance user experience, we will continue exploring innovative mobile finance services by integrating more core functions of the HarmonyOS Intent Framework (such as XiaoYi Search and Suggestion). These innovations aim to deliver a more convenient, efficient, and secure mobile finance experience, positioning JD Finance as a trusted partner.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

HarmonyOSAI integrationFinancial ServicesIntent Framework
JD Cloud Developers
Written by

JD Cloud Developers

JD Cloud Developers (Developer of JD Technology) is a JD Technology Group platform offering technical sharing and communication for AI, cloud computing, IoT and related developers. It publishes JD product technical information, industry content, and tech event news. Embrace technology and partner with developers to envision the future.

0 followers
Reader feedback

How this landed with the community

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.