【问题标题】:admob-free interstitial close event ionic3无 admob 间隙关闭事件 ionic3
【发布时间】:2020-01-06 23:09:54
【问题描述】:

使用Admob-free plugin

如何触发插页式关闭事件,

//this is the code found for javscript
document.addEventListener('admob.interstitial.events.CLOSE', function (event) {
    console.log(event)
    admob.interstitial.prepare()
})
//i want this code  in ionic3 

有人可以帮助如何在 typescript/ionic3 中执行此操作

document.addEventListener 在 typescript 中显示错误

【问题讨论】:

  • 请给出正确答案。

标签: angular ionic2 ionic3


【解决方案1】:
import {Component, Renderer} from '@angular/core';    
constructor(renderer: Renderer) {

            renderer.listenGlobal('document', 'admob.interstitial.events.CLOSE', (event) => {
                console.log(event);
            });

        }

你可以这样做

【讨论】:

    【解决方案2】:

    最好的方法就是如下,但不要忘记在构造函数中注册AdmobFree

    constructor(
        private admobFree: AdMobFree,
        public platform: Platform
    ) {
    
        // Handle interstitial's close event
        this.admobFree.on('admob.interstitial.events.CLOSE').subscribe(() => {
           // handle interstitial close
        });
    }
    

    【讨论】:

      猜你喜欢
      • 2015-08-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-09
      相关资源
      最近更新 更多