Last Updated on : 2023-10-13 02:49:30download
A miniapp offline package, which is stored on the local device, includes all the code and resources needed to run a miniapp. When a native app has an integrated offline package, it will prioritize loading this package to run the miniapp. If no offline package exists on the local device, the latest package will be downloaded from the server.
To improve the user experience of miniapps, the offline package comes with the following capabilities:
Speed up miniapp startup.
If an offline package is available on the local device, it will be loaded first to run the miniapp. This saves time by reducing network requests and speeds up the startup of the miniapp.
Support compatibility with private deployment.
When a miniapp is running, it makes requests to servers. If your app is deployed in a private cloud, but the private deployment is not applied to the MiniApp service accordingly, the miniapp cannot run normally. An offline package stored on the local device can be loaded directly to run the miniapp, eliminating the need to retrieve it from the public cloud.
Control the auto update policy for miniapps.
To control the auto update policy of a miniapp and make it stay at a version, you can build an offline package and allow the miniapp to load this package only.
Smart MiniApp IDE will support the auto building of offline packages in the near future. Currently, contact Tuya to help build an offline package for you. To build an offline package, provide Tuya with the following information:
ThingSmartMiniAppBizBundle
component.ThingSmartXXXKitBizBundle
that is integrated into your project.miniprogam
of the target miniapp.[
{
"id": "xxxxx",// (Required) The miniapp ID.
"version": "1.2.3",// (Optional) The version number of the miniapp. If you specify a version number, the offline package will be built based on this version number.
"path": "pages/index/index",// (Optional) The page that provides access to the miniapp.
"pid": "xxxxx",// The productId with which the panel miniapp is associated. This parameter is required for panel miniapps.
"onlyloadoffline": "true"// (Optional) Specifies whether to only load an offline package.
},
...
]
The version number of the ThingSmartMiniAppBizBundle
component that your project depends on.
ThingSmartXXXKitBizBundle
component that your project depends on.ThingSmartXXXKitBizBundle
components that your project depends on, such as ThingSmartBaseKitBizBundle
, ThingSmartBizKitBizBundle
, and ThingSmartDeviceKitBizBundle
.The result of the offline package build is a .zip
compressed file, named miniapp_offline.zip
.
Integrate this compressed file into your project (mainBundle
and resourceBundle
are applicable) and compile and build the program.
After the integration of the offline package, you can verify the integration result. Perform the following steps:
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback