目录

Obtaining the Atomic Service Link

You can generate a QR code through a short link generated by App Linking and scan the QR code to access the specified page in an atomic service. For details, please refer to Using an Atomic Service Link for Atomic Service Redirection.

When creating an atomic service link in AppGallery Connect, use custom parameters to access a specified page. Set Custom parameters to URL-encoded key-value pairs.

The procedure is as follows:

  1. Set Custom parameters to the specified page path for redirection.

    For example, to redirect to the menu page, enter ascfPara={"path":"/pages/menu"}, in which ascfPara is the key and {"path":"/pages/menu"} is the value.

  2. Perform URL encoding on the value because the Custom parameters field does not support the object type currently.

  3. Ensure that the encoded key-value pair meets the format requirements for Custom parameters.

    Example: ascfPara=%7B%22path%22%3A%22%2Fpages%2Fmenu%22%7D (after UTF-8 URL encoding of the value {"path":"/pages/menu"})

  4. Enter the encoded key-value pair for Custom parameters when you create an atomic service link in AppGallery Connect.

Example: Obtain parameters in the onLaunch and onShow lifecycle callbacks.

App({
  onLaunch(options) {
    // Listen for the ASCF loading. This callback is triggered only once globally upon completion of ASCF initialization. Its parameter is an object containing { path, scene, query, referrerInfo }, equivalent to the return value of has.getLaunchOptionsSync().
  },
  onShow(options) {
    // Listen for the ASCF display. This callback is triggered when the atomic service is loaded for the first time or switched to the foreground. Its parameter is an object containing { path, scene, query, referrerInfo }, equivalent to the return value of has.getEnterOptionsSync().
  }
});