Performance and Experience Optimization

View Markdown

Last edited on 2026-06-16

To ensure a smoother calling experience for both receiving and initiating calls, it is crucial to reduce the time required to launch Mini Program and complete specific network requests.

The cold start of Mini Program takes a certain amount of time, particularly on devices with lower performance, where the startup duration may be prolonged. This directly impacts the user's experience when making or receiving voice and video calls.

1. Mini Program Startup Performance Optimization

It is recommended that developers refer to the Startup Performance Optimization Documentation to optimize the startup time of Mini Program.

On the device-side WMPF, we additionally provide a " Mini Program Warmup" capability. Before the user utilizes Mini Program, it can be pre-launched and kept resident in the background in a headless mode, allowing the user to directly bring Mini Program to the foreground when needed, without going through the full cold start process. The workflow is as follows:

  • After WMPF is activated and before the user utilizes Mini Program, you can call warmUpApp to warm up Mini Program in advance.
  • Typically, it is recommended to specify the path as the plugin's dial/receive page: plugin-private://wxf830863afde621eb/pages/call-page-plugin/call-page-plugin?isPreLaunch=1. If the developer needs Mini Program to open a different page upon launch (e.g., the contact list page), other pages can also be specified for warmup.
  • When the device initiates or receives a call and actually needs to use Mini Program, call launchMiniProgram with standard launch parameters, including a normal path with query strings, to reuse the previously warmed-up environment and bring Mini Program to the foreground.
  • The path part of the path parameter must remain consistent between the warmup and the actual usage; the query part may differ. Otherwise, an additional page reLaunch will be triggered.

Mini Program developers need to identify and adapt to the warmup launch scenario:

  • It is recommended that developers add an isPreLaunch=1 parameter to the warmup path (or use a different name) to identify the warmup entry case.
  • In the query of the App.onShow event, check for the presence of isPreLaunch. If isPreLaunch is 1, it is considered a warmup launch, and no call should be initiated.
  • If isPreLaunch is absent, it is a normal launch. You can retrieve parameters using the plugin's getPluginEnterOptions() and call initByCaller.
const wmpfVoip = requirePlugin('wmpf-voip').default

App({
 onShow() {
 const options = wmpfVoip.getPluginEnterOptions()
 if (options.query.isPreLaunch) {
 // Mini Program warmup scenario, no action required
} else {
 // Normal launch scenario, execute other business logic
}
}
})

Note

  • Referring to Section 4, if the keepRunning parameter is not specified as true when closing Mini Program, the warmup process must be performed again after Mini Program is closed.
  • Warmup or moving to the background does not guarantee that Mini Program will continue running indefinitely. It may be reclaimed due to system resource management policies, or proactively cleaned up by WMPF when in the background for a certain duration or when resources are scarce.

3. Android WMPF Mini Program Environment Preloading

If Mini Program prewarming has been implemented, environment preloading is not required.

If device resources are limited, making it inconvenient to keep Mini Program resident in the background via prewarming, you can use the preload interface to preload the Mini Program environment. This interface only pre-creates a basic Mini Program runtime environment and Mini Program base library; it does not start any specific Mini Program.

4. Android WMPF Background Transition When Closing Mini Program

By default, when the WMPF closeWxaApp interface is called to close Mini Program, the instance of Mini Program is directly destroyed. The next usage will require a cold start (or warm-up).

It is recommended that developers pass keepRunning as true when closing Mini Program. In this case, Mini Program will switch directly to the background, allowing direct reuse in the next session, thereby avoiding redundant cold starts or warm-ups.

5. Ticket Pre-fetching

Tickets such as deviceToken and pushToken used when invoking the plugin initByCaller to initiate a call must be obtained from the WeChat backend. If these tickets are fetched only after the user clicks to start the call, it may increase the time required to initiate the call.

It is recommended that developers prepare these parameters in advance on pages prior to the call initiation (for example, the contact list page). If the user initiates the call within the ticket's validity period, there is no need to fetch them again.