Method | Description | Parameter | Return Value |
|---|---|---|---|
load() | Loads an ad. | - | - |
setRequestConfig(object) | Sets ad request parameters. | For details about ad parameters applicable to all ad units, please refer to RequestConfig. | - |
onLoad(callback) | Listens to ad loading success. | callback: callback for ad loading success. Parameter in callback: Array<AdData> | Promise<Array<AdData>>: data that is returned when an ad is successfully loaded. |
offLoad() | Cancels listening to ad loading success. | - | - |
onError(callback) | Listens to ad loading failure. | callback: callback for ad loading failure, which carries the error code. Parameter in callback: errorcode | - |
offError() | Cancels listening to ad loading failure. | - | - |
reportAdShow(object) | Reports an ad impression. CAUTION: 1. Submit a ticket or send an email to petalads@huawei.com to apply to the traffic operations staff for enabling the capability. 2. Sign in to Petal Publisher Center, click My apps in the navigation tree on the left, find your app, and click Settings in the Operation column. On the page displayed, add the corresponding domain name to Domain name trustlist. | adId: ID of an ad asset. | - |
reportAdClick(object) | Reports an ad click event. CAUTION: 1. Submit a ticket or send an email to petalads@huawei.com to apply to the traffic operations staff for enabling the capability. 2. Sign in to Petal Publisher Center, click My apps in the navigation tree on the left, find your app, and click Settings in the Operation column. On the page displayed, add the corresponding domain name to Domain name trustlist. |
Note: You can pass clickX, clickY, and creativeSize to data, which helps traffic monetization. | - |
reportAdClose(object) | Reports an ad closure event. |
| - |
onAdClick(object) | Called when a user is redirected to a landing page after clicking the ad. |
Note: You can pass clickX, clickY, and creativeSize to data, which helps traffic monetization. | - |
gotoWhyThisAdPage(object) | Goes to the page explaining why an ad is displayed. | adId: ID of an ad asset. | - |
startDownload(object) | Starts app download. CAUTION: 1. Submit a ticket or send an email to petalads@huawei.com to apply to the traffic operations staff for enabling the capability. 2. Sign in to Petal Publisher Center, click My apps in the navigation tree on the left, find your app, and click Settings in the Operation column. On the page displayed, add the corresponding domain name to Domain name trustlist. | adId: ID of an ad asset. | Promise<number>: indicates whether the download is successful. Options of number:
|
resumeDownload(object) | Resumes app download. | adId: ID of an ad asset. | Promise<number>: indicates whether the download is successful after resumption. Options of number:
|
pauseDownload(object) | Pauses app download. | adId: ID of an ad asset. | - |
cancelDownload(object) | Cancels app download. | adId: ID of an ad asset. | - |
getDownloadProgress(object) | Obtains the app download progress. | adId: ID of an ad asset. | Promise<number>: current download progress. Value range of number: [0,100] |
getAppStatus(object) | Obtains the app status. | adId: ID of an ad asset. | Promise<string> The options are as follows:
|
onStatusChanged(callback) | Listens to download status changes. | callback: callback for download status changes. Parameters in callback: packageName and status | - |
offStatusChanged() | Cancels listening to download status changes. | - | - |
onDownloadProgress(callback) | Listens for download progress changes. | callback: callback for download progress changes. Parameters in callback: packageName and progress | - |
offDownloadProgress() | Cancels listening to download progress changes. | - | - |
destroy() | Destroys an ad object. | - | - |
showPrivacyPolicy(object: Object) | Launches the browser to show the privacy policy page. | adId: ID of an ad asset. | |
showAppDetailPage(object: Object) | Shows the app details page. | adId: ID of an ad asset. | |
showPermissionPage(object: Object) | Launches the browser to show the app permission page. | adId: ID of an ad asset. | |
onUserCancel(callback: (ret: Object) | Listens to download cancellation status changes. | callback: callback for download cancellation status changes. Parameters of the callback are packageName and uniqueId. | |
offUserCancel() | Cancels listening to download cancellation status changes. | ||
showPrivacyPolicyInWeb(object: Object) | Shows the privacy policy page using WebView. | adId: ID of an ad asset. | |
showPermissionPageInWeb(object: Object) | Shows the app permission page using WebView. | adId: ID of an ad asset. | |
onAppOpen(callback: (ret: Object) | Listens to app launches. | callback: callback for download status changes. Parameters of the callback are packageName, status, and uniqueId. | |
offAppOpen() | Cancels listening to app launches. | ||
showTransparencyDialog(object: Object,rect: DOMRect, theme: number) | Shows the ad transparency dialog box. | 1. adId: ID of an ad asset. 2. rect: coordinates of the click point. The options are as follows:
| |
dismissTransparencyDialog() | Destroys the ad transparency dialog box. |
Attribute | Type | Description |
|---|---|---|
adId | String | ID of an ad asset. |
adType | number | Ad type. |
app | Advertised app. | |
clickBtnTxt | String | Text to be displayed on an ad interaction button, for example, View details or Install. |
creativeType | number | Ad creative type. For details, please refer to CreativeType and Mapping Between DetailedCreativeType and CreativeType. |
desc | String | Ad description. |
imgList | Array<ImageInfo> | Ad images. |
interactionType | number | Ad purpose.
|
keywords | Array<string> | Reason why an ad is disliked. |
source | String | Ad source. |
title | String | Ad title. |
video | Video ad asset. | |
slotId | String | Ad unit ID. |
showAppElement | number | Indicates whether to show app elements for delivery from the server. |
transparencyOpen | string | Indicates whether ad transparency information is displayed. |
promoteInfo | Information about the promoted entity. | |
abilityInfo | string | HarmonyOS FA. |
Attribute | Type | Description |
|---|---|---|
appName | String | App name. |
appDesc | String | App description. |
iconUrl | String | App icon URL. |
packageName | String | App package name. |
privacyLink | String | Privacy link. |
permissionUrl | String | HTML5 address of the app permission declaration page. |
appDetailUrl | String | HTML5 address of the app details page. |
versionName | String | App version number (similar to 4.52.0). |
developerName | String | App developer information. |
Attribute | Type | Description |
|---|---|---|
width | number | Image width, in pixels. |
height | number | Image height, in pixels. |
imageType | string | Image type.
|
url | String | Image URL. |