InterstitialAd.show
收藏我的收藏
基础库 1.71.0 开始支持本方法,这是一个同步方法。
显示插屏广告。
| 前提条件 | 无 |
| 业务背景 | 无 |
| 使用限制 | 无 |
| 注意事项 | 出现no ad data的错误信息表示服务端无广告返回,通常是平台策略决定的。 |
| 相关教程 | 无 |
语法
InterstitialAd.show()
参数说明
无
返回值
| 类型 | 说明 | 最低支持版本 |
|---|---|---|
| Promise | Promise 对象 | 1.71.0 |
错误码
| errNo | errMsg | 说明 | 最低支持版本 |
|---|---|---|---|
| 2005 | There is no Ad to show! | 小游戏框架内部错误,有需要请创建工单咨询 | 1.71.0 |
| 2005 | An ad can only be displayed once! | 1.71.0 | |
| 1003 | current activity is null, can not create game banner | 1.71.0 | |
| 1003 | Please apply for an adUnitId | 1.71.0 | |
| 1003 | can not create game banner | 小游戏框架内部错误,有需要请创建工单咨询 | 1.71.0 |
| 1006 | The scene does not support advertising | 1.71.0 | |
| 1001 | The adUnitId is empty | 1.71.0 | |
| 1008 | The adUnitId is closed | 1.71.0 | |
| 1007 | The adUnitId is prohibit | 1.71.0 | |
| 1002 | The adUnitId is invalid | 1.71.0 | |
| 20000 | internal error | 小游戏框架内部错误,有需要请创建工单咨询 | 1.71.0 |
| 21000 | fail Video is playing, can't show now! | 1.71.0 | |
| 21000 | This AD has already been shown. It needs to be destroyed and rebuilt | 1.71.0 | |
| 1003 | show fail | 小游戏框架内部错误,有需要请创建工单咨询 | 1.71.0 |
| 21000 | host app not supported | 1.71.0 | |
| 21000 | ad not found | 1.71.0 | |
| 21000 | unitid is illegal | 1.71.0 | |
| 10301 | feature is not supported in app | 1.71.0 | |
| 1003 | host app not supported | 1.71.0 | |
| 1003 | unknown ad type | 1.71.0 | |
| 1003 | ad not found | 1.71.0 | |
| 2006 | InterstitialAd has been destroyed | 1.71.0 | |
| 2001 | Just started the %s, can't show now! | 1.71.0 | |
| 2002 | Just shown an Ad, can't show now! | 1.71.0 | |
| 21000 | The interstitial advertisement for current adUnitId hasn't completed loading. | 小游戏框架内部错误,有需要请创建工单咨询 | 1.71.0 |
代码示例
const ad = tt.createInterstitialAd({ adUnitId: "YOUR_UNIT", }); ad.load() .then(() => { ad.show().then(() => { console.log("插屏广告展示成功"); }); }) .catch((err) => { console.log(err); });
