Create H5 offline packages

Updated at:

To create an H5 offline package, you need to provide basic information and configuration settings.

Prerequisites

Ensure you have configured the H5 offline package settings on the configuration management page. For more information, see Configure an Offline Package.

Overview

You can create H5 offline packages individually or use the batch import feature to add multiple packages at once.

When you upload the first offline package for an H5App, you must select a resource package type, which cannot be changed later. Each H5App supports only one resource package type.

Procedure

Create a single offline package

Log in to the mPaaS console and complete the following steps:

  1. In the left navigation pane, choose Real-time Release > Offline Package Management.

  2. On the Offline Package Management page, click Create H5App. (If you have already created an H5App, you can skip this step.)

  3. In the Create H5App dialog box, enter the H5App ID and H5App name, and then click OK. (If you have already created an H5App, you can skip this step.)

    Important
    • The H5App ID must be an 8-digit number.

    • The IDs 20000196, 66666692, 68687029, and 68687209 are reserved for built-in SDK offline packages. To avoid conflicts, do not use these IDs for your H5App.

    • Avoid using H5App IDs that start with 666666 or 20000.

  4. In the H5App list, select an H5App, and then click Add Offline Package in the upper-right corner of the offline package list.

  5. In the Basic Information section, complete the following settings:

    • Resource package type: Select global resource package or normal resource package.

      Note

      If you use a global resource package, you must change the subdirectory name to mcube-prod.mpaascloud.com within the package. Otherwise, the acceleration feature of Real-time Release will not work.

    • Offline package version: Enter a version for the offline package, such as 1.0.0.1.

    • File: Upload the offline package resource file. The file must be in .zip format.

    • Client version range: Select the client type for the app and set the version range. Only clients within this version range will receive the new offline package.

      Note
      • You must select at least one client type. If you select both Android and iOS, their maximum version policies must be consistent: either both use the system default or both use a custom value.

      • Setting the maximum version to the system default supports all future versions. This is the recommended approach to ensure the offline package continues to work after client upgrades.

      • The iOS client version must be less than the Product Version field in the client project's info.plist file.

  6. In the Configuration Information section, complete the following settings:

    • Main entry URL: Optional. The homepage of the offline package.

      Note

      You must enter the full path, such as /www/index.html, where /www is the name of your custom subdirectory.

    • Virtual domain name: Automatically displays the virtual domain name you entered when configuring the offline package.

    • Extended information: Optional. Enter page loading parameters as key-value pairs. Use commas (,) to separate multiple pairs.

      mPaaS allows you to configure the request interval for H5 offline packages either for an individual package or globally.

      • Individual configuration: To configure the interval for the current package only, enter {"asyncReqRate":"1800"} in the Extended information field. The value 1800 represents the interval in seconds. The valid range is 0 to 86,400 seconds (0 to 24 hours). A value of 0 means the request interval is unlimited.

      • Global configuration: To configure the interval globally, you must do so in the client-side code. For more information, see Integrate with Android and Integrate with iOS.

    • Download timing: Choose when the user's device downloads this offline package.

      • If you select Wi-Fi only, the device automatically downloads the offline package in the background only when connected to a Wi-Fi network.

      • If you select Download on all networks, the device automatically downloads the package on non-Wi-Fi networks, which may consume cellular data. Use this option with caution.

    • Installation timing: Choose when the user's device installs this offline package.

      • If you select Do not preload, the package installs only when the user opens the offline package or mini program page.

      • If you select Preload, the offline package or mini program installs automatically after it finishes downloading.

  7. Select the I have confirmed that the above information is accurate checkbox, and then click Submit.

Batch import offline packages

To create multiple offline packages, use the batch import feature for better efficiency and fewer configuration errors.

  • If an imported package is for a new H5App, the system automatically creates the H5App.

  • If an imported package is for an existing H5App, the package is added to that H5App.

Log in to the mPaaS console and complete the following steps:

  1. In the left navigation pane, go to the Real-time Release > Offline Package Management page and click Batch Import H5 Offline Packages.

  2. In the Batch Import H5 Offline Packages window, upload the H5 offline package files (.zip) as prompted.

    Note
    • You can import up to 100 offline packages at a time, with a total file size not exceeding 300 MB.

    • Each offline package resource file must be named with its corresponding 8-digit offline package ID.

  3. The import results page lists the successfully loaded offline packages. On this page, click Edit in the Actions column to edit the basic information for each package. For an explanation of the configuration options, see Create a single offline package.

    On the import results page, you can edit the offline package version numbers, which default to the following:

    • For a package in a new H5App, the version number defaults to 0.0.0.1.

    • For a package in an existing H5App, the version number is automatically incremented from the highest existing version.

  4. After editing all offline packages, select the The information cannot be modified after submission checkbox and click Submit. The system then validates the information. If validation passes, the new H5 offline packages appear on the Offline Package Management page. If it fails, an error message is displayed.

Next steps

Release an offline package