打开小程序
此接口暂不支持在CloudGrid里面调试[!TIP|labelVisibility:hidden|iconVisibility:hidden] navigator.miniProgram.openMiniProgram(uniqueCode,success,error)
支持平台:
- Android
- iOS
参数说明
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| uniqueCode | String | 是 | 小程序唯一编号 |
| success | Function | 是 | 成功回调函数 |
| error | Function | 是 | 失败回调函数 |
uniqueCode 参数为小程序唯一编号,对应平台创建的小程序ID,参考

success 直接跳转到小程序
error 函数会返回一个对象,其属性包含以下一项或多项:
code(Int) -- 错误码resultDes(String) --错误描述
错误码说明
| 错误码 | 说明 |
|---|---|
| 98 | 参数缺失 |
| 99 | 网络问题 |
| 101 | 其他错误 |
| 102 | 参数错误 |
| 103 | Token超时 |
| 104 | Token不匹配 |
| 105 | Token缺失 |
示例代码
// 引用js
<script src='supconit://hcmobile.js'></script>
<script>
// 监听’deviceready‘事件
document.addEventListener('deviceready', onDeviceReady, false)
function onDeviceReady(){
navigator.miniProgram.openMiniProgram('2152373',
function (success) {},
function (error) {
alert(JSON.stringify(error));
});
}
</script>
响应失败示例代码:
{
"resultDes": "获取小程序详情失败!",
"code": 101
}