扫码打开小程序

小程序 SDK 支持通过扫描二维码即小程序码,解析二维码之后打开小程序。可以通过以下示例代码调用起小程序。

方法调用

if (!TextUtils.isEmpty(qrcode) && qrcode.startsWith("h5app:")) {
H5appManagerUtilImpl h5appManagerUtil = new H5appManagerUtilImpl();
h5appManagerUtil.gotoH5AppWithQrCode(context, qrcode, sceneId); //sceneId 为SCENE_ID_FROM_H5APP_CODE
} else {
......
//按照原来的逻辑执行
}

其中qrcode为二维码结果串。在获取到二维码结果之后,对该字符串结果进行解析时,可以通过判断该字符串是否是以 h5app:// 为开头。如果是则调用上述的示例代码,调起小程序;否则按照原逻辑执行。

  1. 1. 扫码打开小程序
    1. 1.1. 方法调用