# LaunchWxaAppByQrCode

建议使用 WMPFMiniProgramApi.launchByQRScanCode 接口.

用于扫码拉起某个小程序

# 调用参数

属性 说明
rawData 二维码识别数据
isNativeView 是否需要 NativeView

# 返回参数

无参数

# 示例代码

val request = WMPFLaunchWxaAppByQRCodeRequest()
request.baseRequest = WMPFBaseRequestHelper.checked()
request.baseRequest.clientApplicationId = ""
request.rawData = rawData // rawData from qrcode

Log.i(
    TAG, "launchWxaApp: " + "hostAppID = " +
            BuildConfig.HOST_APPID + ", deviceId = " + DeviceInfo.deviceId
)

val result = WMPFIPCInvoker.invokeAsync<IPCInvokerTask_LaunchWxaAppByQrCode,
        WMPFLaunchWxaAppByQRCodeRequest, WMPFLaunchWxaAppByQRCodeResponse>(
    request,
    IPCInvokerTask_LaunchWxaAppByQrCode::class.java
) { response ->
    if (isSuccess(response)) {
        it.onSuccess(response)
    } else {
        it.onError(TaskErrorException(createTaskError(response)))
    }
}

if (!result) {
    it.onError(Exception("invoke launchWxaAppByScan fail"))
}

// 还可以通过 launchWxaByScanUI 接口实现带有 UI 交互的扫码拉起小程序功能
LaunchWxaAppByScanInvoker.launchWxaByScanUI(this, request)