# tap.hasHomeScreenWidgetAndPinned(Object object)
相关文档: 桌面文件夹
# 功能描述
查询小游戏是否已经存在桌面创建快捷方式,是否在最前面
平台差异说明:
- Android:支持完整的桌面小组件状态检测功能
- iOS:由于系统限制,iOS 无法准确检测是否已添加到桌面,此接口仅能作为参考。返回结构中不支持
isPinned字段,可以无视
# 参数
# Object object
| 属性 | 类型 | 默认值 | 必填 | 说明 |
| success | function | 否 | 接口调用成功的回调函数 | |
| fail | function | 否 | 接口调用失败的回调函数 | |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
# object.success 回调函数
# 参数
# Object res
| 属性 | 类型 | 说明 |
| hasWidget | boolean | 这个为true只代表有桌面小组件,不保证这个小游戏添加到小组件了 |
| isPinned | boolean | 这个小游戏被添加到了小组件列表,并且在首位。注意:iOS 平台不支持此字段 |
# 示例代码
tap.hasHomeScreenWidgetAndPinned({
success: ({errMsg,hasWidget, isPinned, isAdded}) => {
/* 查询成功回调
* @param hasWidget 用户是否使用TapTap App添加了桌面小组件
* @param isPinned 本小游戏是否在桌面小组件列表中并且是第一个(iOS平台不支持)
* @param isAdded 本小游戏是否在桌面小组件列表中
*
* 平台差异:
* - Android:支持完整的桌面小组件状态检测
* - iOS:isPinned 字段不支持
*/
},
fail: ({errMsg, errno}) => {
/* 查询失败回调
* @param errMsg 错误信息
* @param errno 错误码
*/
},
complete: ({errMsg, errno}) => {
/* 查询完成回调
* @param errMsg 错误信息
* @param errno 错误码
*/
}
})
