tencent cloud

Tencent Cloud Super App as a Service

DokumentasiTencent Cloud Super App as a Service

Mini Program Update Mechanism

Mode fokus
Ukuran font
Terakhir diperbarui: 2025-11-07 18:07:53

Silent updates

After developers release a new version of a mini program in the management backend, the superapp will periodically check for updates to the locally cached mini program. However, if users have an older version of the mini program installed, they may still open the old version. In general, after a new version is released, it cannot immediately affect all live users. Typically, within 24 hours of a full release, the new version can cover over 99% of users, who will update to the latest version the next time they open the superapp.

Synchronous update on launch

The mini program will synchronously update the code package during startup in the following scenarios. Synchronous updates will block the startup process, affecting the startup time of the mini program.
If the update fails or times out, the local version will still be used to ensure the mini program remains usable.

Periodic check for version updates

The superapp runtime will periodically check if recently used mini programs have updates. If an update is found, it will be synchronously updated the next time the mini program is launched, ensuring that users can quickly access the latest version.

When users haven't used the mini program for a long time

If users have not used the mini program for an extended period, a forced synchronous check for version updates will occur to ensure the mini program is up to date. After updating to the latest version, the mini program will then open.
If users are in a weak network environment or if the download of the latest version fails, the local older version will still be launched.

Asynchronous update on launch

Even if no updates are detected before launch, the mini program will asynchronously check for updates during each cold start. If a new version is found, the code package for the new version will be downloaded asynchronously. However, the current launch will still use the locally cached older version, meaning the new version will only be used during the next cold start.

Manual update trigger by developers

In the case of asynchronous updates on launch, if developers want to trigger an immediate version update, they can use the wx.getUpdateManager API. This will prompt users to restart the mini program to update to the new version when one is available.
const updateManager = wx.getUpdateManager()

updateManager.onCheckForUpdate(function (res) {
// Callback after requesting new version information
console.log(res.hasUpdate)
})

updateManager.onUpdateReady(function () {
wx.showModal({
title: 'Update notification',
content: 'A new version is ready. Would you like to restart the application?
success(res) {
if (res.confirm) {
// The new version has been downloaded, call applyUpdate to apply the new version and restart
updateManager.applyUpdate()
}
}
})
})

updateManager.onUpdateFailed(function () {
// New version download failed
})
Debugging API: The IDE provides debugging capabilities for forced updates. By selecting Simulate update during next compilation in the compilation mode settings, you can debug the forced update feature in the IDE (this cannot be debugged on a real device).


Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan