HarmonyOS SDK Integration Guide

Last updated:2026-06-15
Expand all
HarmonyOS SDK Integration Guide

Usage Tips

This document is the standard integration guide for the JMLink HarmonyOS SDK.

The supported SDK version is v1.0.0 and later.

  • If you want to quickly test, please refer to this document to run through the Demo in a few minutes.
  • The JiGuang MagicLink documentation website contains all related guides, APIs, tutorials, and other documentation. Updated versions of this document will also be published to that website in a timely manner.

Product Description

JiGuang MagicLink provides developers with capabilities such as link launching, parameter pass-through, and scene restoration, making it easy to handle business scenarios like activity engagement, invitation sharing, and content navigation within the App.

Main Scenarios

  • Scheme Launch
  • App Linking Launch
  • Link Parameter Pass-through
  • Scene Restoration

Obtaining Application Information

After creating an application on the console, you can navigate to the MagicLink configuration page to obtain the AppKey used to identify the application.

Integration Methods

ohpm Automatic Integration

"dependencies": { "@jg/mlink": "^1.0.0" // Set up JiGuang MagicLink automatic integration }
          "dependencies": {
    "@jg/mlink": "^1.0.0" // Set up JiGuang MagicLink automatic integration
}

        
This code block is shown in the floating window

Manual Integration

  • jmlink-hmos-x.x.x-release.har

    • JiGuang MagicLink HarmonyOS SDK core package.
  • doc

    • Documentation
  • entry

    • A HarmonyOS demo project that demonstrates the basic usage of the JMLink SDK, which can be used as a reference.

HAR File Integration

  • Extract the jmlink-hmos-x.x.x-release.zip integration package.
  • Copy jmlink-hmos-x.x.x-release.har to the entry/hars/ directory of your project. (The hars directory name can be customized)

Note: To link jmlink-hmos-x.x.x-release.har, for example, if you copy the har to the entry/hars/ directory, add the following to the oh-package.json5 file under the entry module:

"dependencies": { "@jg/mlink": "./hars/jmlink-hmos-x.x.x-release.har" // The path here is where you stored jmlink-hmos-x.x.x-release.har }
          "dependencies": {
    "@jg/mlink": "./hars/jmlink-hmos-x.x.x-release.har" // The path here is where you stored jmlink-hmos-x.x.x-release.har
}

        
This code block is shown in the floating window

Configure Permissions

Configure the permissions required by MagicLink in module.json5:

"requestPermissions": [ { "name": "ohos.permission.INTERNET" }, { "name": "ohos.permission.GET_NETWORK_INFO" } ],
          "requestPermissions": [
  {
    "name": "ohos.permission.INTERNET"
  },
  {
    "name": "ohos.permission.GET_NETWORK_INFO"
  }
],

        
This code block is shown in the floating window

Configure JiGuang Platform Information

The main steps are:

  • Create an App on the JiGuang platform and obtain the package name and AppKey

    Note:

    Configure the package name in the local project by adding the following to the app.json5 file under the AppScope directory:

{ "app": { "bundleName": "your.package.name", } }
          {
  "app": {
    "bundleName": "your.package.name",
  }
}

        
This code block is shown in the floating window

Configure Scheme Launch

If you need to launch the application via Scheme, configure the viewData skill in the target Ability of entry/src/main/module.json5.

"skills": [ { "entities": [ "entity.system.browsable" ], "actions": [ "ohos.want.action.viewData" ], "uris": [ { "scheme": "mlinkdemo", "host": "open", "pathStartWith": "/home" } ] } ]
          "skills": [
  {
    "entities": [
      "entity.system.browsable"
    ],
    "actions": [
      "ohos.want.action.viewData"
    ],
    "uris": [
      {
        "scheme": "mlinkdemo",
        "host": "open",
        "pathStartWith": "/home"
      }
    ]
  }
]

        
This code block is shown in the floating window

Example link:

mlinkdemo://open/home?from=test
          mlinkdemo://open/home?from=test

        
This code block is shown in the floating window

Configure App Linking Launch

If you need to launch the application via an https link, configure the https-type viewData skill in the target Ability of entry/src/main/module.json5 and enable domainVerify.

"skills": [ { "entities": [ "entity.system.browsable" ], "actions": [ "ohos.want.action.viewData" ], "uris": [ { "scheme": "https", "host": "applink.example.com", "pathStartWith": "/mlink" } ], "domainVerify": true } ]
          "skills": [
  {
    "entities": [
      "entity.system.browsable"
    ],
    "actions": [
      "ohos.want.action.viewData"
    ],
    "uris": [
      {
        "scheme": "https",
        "host": "applink.example.com",
        "pathStartWith": "/mlink"
      }
    ],
    "domainVerify": true
  }
]

        
This code block is shown in the floating window

Example link:

https://applink.example.com/mlink?from=test
          https://applink.example.com/mlink?from=test

        
This code block is shown in the floating window

Both the server side and the console need to complete the following configurations. For AppGallery Connect configuration requirements, please refer to the official documentation:

https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/app-linking-kit-guide

  • Enable the App Linking capability on the console.
  • Configure the https domain or URL prefix for launching the application on the console.
  • Configure the domain verification file on the domain side as required by HarmonyOS App Linking.
  • Ensure the domain, package name, and current application configuration are consistent.

Other Features

Please refer to: HarmonyOS SDK API Reference

Running the Demo

The demo included in the package is an API demonstration example. You can import it into your project, configure your AppKey, package name, Scheme, and App Linking domain, and then run it directly to test.

Technical Support

Email: support@jiguang.cn

Was this document helpful?

Copyright 2011-2026, jiguang.cn, All Rights Reserved. 粤ICP备12056275号-13 Shenzhen Hexun Huagu Information Technology Co., Ltd.

Open in Docs Center