1# @ohos.advertising.AdsServiceExtensionAbility (广告扩展服务) 2 3本模块为设备厂商提供广告扩展能力,设备厂商可自主实现请求广告的回调。 4 5> **说明:**<br/> 6> 本模块首批接口从API version 11开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 7 8## 导入模块 9 10```ts 11import { RespCallback } from '@kit.AdsKit'; 12``` 13 14## RespCallback 15 16### (respData: Map<string, Array<advertising.Advertisement>>) 17 18(respData: Map<string, Array<advertising.Advertisement>>): void 19 20广告请求回调。 21 22**系统能力:** SystemCapability.Advertising.Ads 23 24**参数:** 25 26| 参数名 | 类型 | 必填 | 说明 | 27|----------|---------------------------------------------------------------------------------------------------|-----|-----------------| 28| respData | Map<string, Array<advertising.[Advertisement](js-apis-advertising.md#advertisement)>> | 是 | 广告请求回调数据。 | 29 30**示例:** 31 32```ts 33import { advertising, RespCallback } from '@kit.AdsKit'; 34 35function setRespCallback(respCallback: RespCallback) { 36 const ads: Array<advertising.Advertisement> = []; 37 const rewardVerifyConfig: Map<string, string> = new Map(); 38 ads.push({ 39 adType: 7, 40 uniqueId: '111111', 41 rewardVerifyConfig: rewardVerifyConfig, 42 rewarded: false, 43 shown: false, 44 clicked: false 45 }) 46 const slot: string = 'test'; 47 const respData: Map<string, Array<advertising.Advertisement>> = new Map(); 48 respData.set(slot, ads); 49 respCallback(respData); 50} 51```