Starting from version 1078, the API prefix has been changed from hbs to qg. The original prefix hbs is still supported.
API | Description |
|---|---|
Checks whether a home screen icon has been created for a quick game. | |
Creates a home screen icon for a quick game. |
Parameter | Type | Mandatory | Description |
|---|---|---|---|
success | function | No | Callback function triggered upon success.
|
fail | function | No | Callback function triggered upon a failed API call. |
complete | function | No | If a function is passed, it will be called regardless of whether the API call succeeds or fails. |
qg.hasShortcutInstalled({
success : function (res) {
console.log("hasInstalledsuccess: " + res);
if (res) {
// A home screen icon has been created.
} else {
// No home screen icon has been created.
}
},
fail:function(data){
console.log("hasInstalled fail: " + data);
},
complete:function() {
console.log("hasInstalled complete");
}
}); Parameter | Type | Mandatory | Description |
|---|---|---|---|
message | string | No | Prompt message. |
success | function | No | Callback function triggered upon a successful API call. |
fail | function | No | Callback function triggered upon a failed API call. |
complete | function | No | If a function is passed, it will be called regardless of whether the API call succeeds or fails. |
Result Code | Description |
|---|---|
201 | Failed to obtain the permission for creating a home screen icon for a quick game because the user rejected the request. |
220 | The home screen icon cannot be created. |
qg.installShortcut({
message: 'Adds the shortcut to the desktop for convenient use next time.',
success: function (ret) {
console.log('handling install success');
},
fail: function (errMsg, errCode) {
console.log('handling install fail: ' + errMsg + ", errCode: " + errCode);
},
complete:function() {
console.log("handling install complete");
}
});