# ks.checkShortcut
检查小游戏快捷方式是否已添加到手机桌面上,仅 Android 支持
请求 object
字段名 | 类型 | 描述 | values |
---|---|---|---|
success | function | 接口调用成功的回调函数 | |
fail | function | 接口调用失败的回调函数 | |
complete | function | 接口调用结束的回调函数(调用成功、失败都会执行) |
回调成功
字段名 | 类型 | 描述 | values |
---|---|---|---|
code | int | 1 表示成功 | |
installed | bool | 是否安装 |
回调失败
字段名 | 类型 | 描述 | values |
---|---|---|---|
code | int | 异常错误码 | |
msg | string | 错误信息 |
example
ks.checkShortcut({
success(res) {
//根据res.installed 来判断是否添加成功
console.log("是否已添加快捷方式", res.installed);
},
fail(err) {
if (err.code === -10005) {
console.log("暂不支持该功能");
} else {
console.log("检查快捷方式失败", err.msg);
}
},
});