API | Description |
|---|---|
Checks whether a HarmonyOS app or quick game has been installed. A quick game is considered installed only when a home screen icon has been created for it. | |
Obtains the version name and number of an app. | |
Obtains app signature digests. |
Checks whether a HarmonyOS app or quick game has been installed. A quick game is considered installed only when a home screen icon has been created for it.
Parameter | Type | Mandatory | Description |
|---|---|---|---|
package | string | Yes | App package name. |
success | function | No | Callback function triggered upon a successful API call. For details, please refer to Parameters in the success callback function. |
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.hasPackageInstalled({
package: "com.***.appmarket",
success(res) {
console.log("Installation successful", JSON.stringify(res))
} ,
fail (res,code) {
console.log("Installation failed",res,code)
},
complete() {
console.log("Installation completed");
}
}); Obtains the version name and number of a HarmonyOS app or quick game.
Parameter | Type | Mandatory | Description |
|---|---|---|---|
package | string | Yes | App package name. |
success | function | No | Callback function triggered upon a successful API call. For details, please refer to Parameters in the success callback function. |
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. |
Parameter | Type | Description |
|---|---|---|
versionCode | number | string | Version number mapping the queried package name. For quick games:
|
versionName | string | Version name mapping the queried package name. |
qg.getInstalledPackageInfo({
package: "com.huawei.appmarket",
success: function (data) {
console.log('getInstalledPackageInfo success . msg ' + JSON.stringify(data));
},
fail: function (data, code) {
console.log('getInstalledPackageInfo fail . code ' + code + '; data = ' + data);
},
complete: function () {
console.log('getInstalledPackageInfo complete .');
},
}); Obtains the signature digests of a HarmonyOS app or quick game.
Parameter | Type | Mandatory | Description |
|---|---|---|---|
package | string | Yes | App package name. |
success | function | No | Callback function triggered upon a successful API call. For details, please refer to Parameters in the success callback function. |
fail | function | No | Callback function triggered upon a failed API call. For details, please refer to Result codes passed to fail. |
complete | function | No | If a function is passed, it will be called regardless of whether the API call succeeds or fails. |
Parameter | Type | Description |
|---|---|---|
signatureDigests | array | string | List of signatures encrypted using the SHA-256 algorithm.
|
Result Code | Description |
|---|---|
202 | Invalid parameter. |
1000 | No app found. |
qg.getSignatureDigests({
package: "com.huawei.appmarket",
success: function (data) {
console.log('getSignatureDigests success . msg ' + JSON.stringify(data));
},
fail: function (data, code) {
console.log('getSignatureDigests fail . code ' + code + '; data = ' + data);
},
complete: function () {
console.log('getSignatureDigests complete .');
},
});