BannerAd.show收藏我的收藏
收藏
我的收藏基础库 1.3.0 开始支持本方法,这是一个同步方法。
广告创建后默认是隐藏的,可以通过该方法显示广告。 该方法返回一个 Promise 对象。当广告组件正常获取素材时,该 Promise 对象会是一个 resolved Promise。当广告组件发生错误时,会是一个 rejected Promise,参数与 error 事件监听器获得的参数相同。
前提条件 | 无 |
业务背景 | 无 |
使用限制 | 无 |
注意事项 | 必须调用 BannerAd.onLoad 监听广告素材成功拉取后才能调用 BannerAd.show,否则广告将无法及时展示 |
相关教程 | 无 |
语法
BannerAd.show()
参数说明
无
返回值
类型 | 说明 | 最低支持版本 |
---|---|---|
Promise | Promise 对象 | 1.3.0 |
错误码
errorCode | errMsg | errorType | 说明 | 最低支持版本 |
---|---|---|---|---|
122407 | Just shown an Ad, can't show now! | D | 1.3.0 | |
999987 | feature is not supported in app | D | 1.3.0 | |
999991 | context exception | F | 小游戏框架内部错误,有需要请创建工单咨询 | 1.3.0 |
122401 | current activity is null, can not create game banner | D | 1.3.0 | |
122403 | Please apply for an adUnitId | D | 1.3.0 | |
122402 | can not create game banner | F | 小游戏框架内部错误,有需要请创建工单咨询 | 1.3.0 |
999987 | The scene does not support advertising | D | 1.3.0 | |
999999 | The adUnitId is empty | D | 1.3.0 | |
122404 | The adUnitId is closed | D | 1.3.0 | |
122405 | The adUnitId is prohibit | D | 1.3.0 | |
122406 | The adUnitId is invalid | D | 1.3.0 | |
999993 | internal error | F | 小游戏框架内部错误,有需要请创建工单咨询 | 1.3.0 |
999986 | Just shown an Ad, can't show now! | D | 1.3.0 | |
999986 | GridGamePanel with the same gridCount can show most one | D | 重复报 callback & event | 1.3.0 |
999986 | The banner advertisement has triggered fallback, but fallback ad has shown too many times today | D | 重复报 | 1.3.0 |
122410 | The banner advertisement for current adUnitId hasn't completed loading | D | 1.3.0 | |
122410 | ad is not loaded, try call `show` in `onLoad` method | D | 重复报 | 1.3.0 |
122409 | ad not found | D | 1.3.0 | |
999999 | unitid is illegal | D | 1.3.0 | |
122403 | unitid is illegal | D | 1.3.0 | |
122407 | unitid is illegal | D | 1.3.0 | |
122404 | unitid is illegal | D | 1.3.0 | |
122405 | unitid is illegal | D | 1.3.0 | |
999993 | unitid is illegal | F | 小游戏框架内部错误,有需要请创建工单咨询 | 1.3.0 |
122409 | The banner advertisement for current adUnitId doesn't exist | D | 1.3.0 | |
999999 | The adUnitId is empty | D | 1.3.0 | |
122403 | The adUnitId is invalid | D | 1.3.0 | |
122407 | unknown ad type | D | 1.3.0 | |
999993 | The adUnitId is invalid | F | 小游戏框架内部错误,有需要请创建工单咨询 | 1.3.0 |
999993 | type is illegal param | F | 小游戏框架内部错误,有需要请创建工单咨询 | 1.3.0 |
999994 | app has enter background | U | 1.3.0 |
代码示例
const bannerAd = tt.createBannerAd({ adUnitId: "xxxx", }); bannerAd.onLoad(() => { bannerAd .show() .then(() => { console.log("广告显示成功"); }) .catch((err) => { console.log("广告组件出现问题", err); }); });
点击纠错