Advertisement
Advertisement is the ad content requested by advertising.
NOTE The initial APIs of this module are supported since API version 11. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Modules to Import
import { advertising } from '@kit.AdsKit';
Attributes
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.Advertising.Ads
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| adType | number | No | No | Ad type. - 1: splash ad. - 3: native ad. - 7: rewarded ad. - 8: banner ad. - 12: interstitial ad. - 60: roll ad. If this parameter is left empty, the native ad is used by default. |
| uniqueId | string | No | No | Unique ID of the ad. |
| rewarded | boolean | No | No | Whether users get rewarded for watching or clicking the ad. - true: Users get rewarded. - false: Users do not get rewarded. |
| shown | boolean | No | No | Whether the ad is shown. - true: The ad is shown. - false: The ad is not shown. |
| clicked | boolean | No | No | Whether the ad is clicked. - true: The ad is clicked. - false: The ad is not clicked. |
| rewardVerifyConfig | Map<string, string> | No | No | Server verification parameter. { customData: "test", userId: "12345" } |
| [key: string] | Object | No | Yes | Custom parameter. - isFullScreen: The value is of the Boolean type. It specifies whether a splash ad is in full-screen mode. The value true means that the ad is in full-screen mode, and false means that the ad is in half-screen mode. - biddingInfo: An object containing ad information. It is used to obtain real-time bidding results. biddingInfo.price: the Effective Cost Per Mille (eCPM) of an ad. biddingInfo.cur: the currency of an ad. biddingInfo.nurl: URL used to specify the successful bidding results returned by the media. biddingInfo.lurl: URL used to notify other Demand-Side Platforms (DSPs) of the bidding success result when the bidding fails. |