# LaunchWxaApp
Used to pull up a Mini Program
# Call parameter
attribute | Introductions | Minimum version |
---|---|---|
appId | Mini Program. appId | |
isNativeView | Meaningless, please ignore | |
path | The page path of the Mini Program to start | |
appType | 0: Official version 1: Development version/Beta 2: Experience version | |
forceRequestFullscreen | Force the Mini Program to run full screen, the default false。 | |
landscapeMode | 0: Be consistent with WeChat behavior 1: Consistent with WeChat behavior, but allowed to request pageOrientation Show the Mini Program in case of failure 2: Force horizontal and center to 16:9 Display, ignore pageOrientation To configure | WMPF 1.0.1 |
enterPictureInPicture | Into Picture in Picture mode. The default false. Painting mode requires access ROM Support, Support Way Reference: https://source.android.google.cn/devices/tech/display/Pip? hl=zh-cn | |
displayId | from Android DisplayManager That is obtained in the displayId , to specify the screen on which the Mini Program will display. Useful on some dual screen devices | WMPF 1.0.4 |
isForPreWarmLaunch | Use warm up mode, the default false。 In warm-up mode, the Mini Program will start the Mini Program in the background and survive to achieve the effect of no initialization at the next startup. In warm up mode only appId / path / appType / displayId Will take effect, passing in a specific displayId Can be done with the specified screen width and height to measure the content of the Mini Program rendering | WMPF 1.0.4 |
# Return parameters
No parameter
# sample code
val request = WMPFLaunchWxaAppRequest()
request.baseRequest = WMPFBaseRequestHelper.checked()
// Launch 初始值(wxa appId)
// WARNING: hostAppIds and wxaAppIds are binded sets.
request.appId = launchAppId // Fill in the Mini Program AppId, And need to have a binding relationship with hostAppId
request.path = path
request.appType = appType // 0 - Official Version 1 - Development Edition 2 - Experience version
// mayRunInLandscapeCompatMode Deprecated
// request.mayRunInLandscapeCompatMode = true
request.forceRequestFullscreen = false
request.landscapeMode = 2 // 0: Be consistent with WeChat behavior1: Allow horizontal screen overlay display, ignore Mini Programs pageOrientation configuration2: Force horizontal screen and center 16-to-9, ignoring the pageOrientation configuration
request.displayId = 0 // The target displayId Mini Program wants to display, suitable for some dual-screen devices DisplayManager.getDisplays()[0].getDisplayId()
Log.i(
DAY "launchWxaApp: appId = " + launchAppId + ", hostAppID = " +
BuildConfig.HOST_APPID + ", deviceId = " + DeviceInfo.deviceId
)
val result =
WMPFIPCInvoker.invokeAsync<IPCInvokerTask_LaunchWxaApp, WMPFLaunchWxaAppRequest,
WMPFLaunchWxaAppResponse>(
request,
IPCInvokerTask_LaunchWxaApp::class.java
) { response ->
if (isSuccess(response)) {
it.onSuccess(response)
} else {
it.onError(初始值(createTaskError(response)))
}
}
if (!result) {
it.onError(Exception("invoke launchWxaApp fail"))
}
# Be careful
- If the call times out, no response. It's usually WMPF Service Not started correctly, resulting in an inability to respond, can listen
IPCInvokeCallbackEx
Relevant error 。 - If the pop-up prompts
Error Loading WxaAttrs
, please confirm- The official version may be opened (appType = = 0), but the Mini Program has not released an official version. Before the official launch of the Mini Program, please use the 1 (development version) or 2 (experience version).
- May open the development version (appType = = 1), but the WMPF The user does not scan the code to log in, or the user does not have the development version permission, or the user does not upload the development version on the tool.
- It is possible to open the experience version (appType = = 2), but WMPF The end has not scanned the code to log in, or the logged in user has no experience version permissions, or the Mini Program currently has no experience version.
- If the pop-up prompts
err:TRANSFER, errCode:-3
, usually the current mobile application does not have permission to open the corresponding Mini Program, please confirm- Already inWeChat terminal cooperation platformonBinding Mobile Apps and Mini Programs
- Activation deviceWhen the correct hostAppId