Ionic-Heyzap广告没有显示

时间:2018-07-13 14:25:00

标签: cordova ionic-framework ionic2 cordova-plugins heyzap

我必须集成Heyzap cordova SDK,并且Heyzap附带的showMediationTestSuite正常运行,问题是我想展示无法成功实现的广告和横幅,

home.ts

import { Component } from '@angular/core';
import { NavController, Platform } from 'ionic-angular';

declare var HeyzapAds: any;
@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

  constructor(public navCtrl: NavController, public platform: Platform) {

  }

  ionViewDidLoad() {

    this.platform.ready().then(() => {
      HeyzapAds.start("Hyzap Ids").then(function() {
      }, function(error) {

      });

    });
  }

  showAds()
  {
    HeyzapAds.InterstitialAd.show().then(function() {
      // Native call successful.
      document.getElementById('demo2').innerHTML=  HeyzapAds.VideoAd.show();
    }, function(error) {
      // Handle Error
      document.getElementById('demo').innerHTML= error;

    });
  }

  InterstitialAd(){
    HeyzapAds.InterstitialAd.show().then(function() {
      // Native call successful.
      document.getElementById('demo1').innerHTML=  HeyzapAds.InterstitialAd.show();
    }, function(error) {
      // Handle Error
      document.getElementById('demo').innerHTML= error;

    });

  }

  fetchVideo() {

    HeyzapAds.VideoAd.fetch().then(function() {
      // Native call successful.
      document.getElementById('demo').innerHTML=  HeyzapAds.VideoAd.fetch();

    }, function(error) {
      // Handle Error
      document.getElementById('demo').innerHTML = error;
    });


  }
}

home.html

<div id="demo">
  </div>
  <div id="demo1">
  </div>
  <div id="demo2">
  </div>
  <button ion-button color="secondary" (click)="fetchVideo()">  
  fetchVideo</button>
  <button ion-button color="secondary" (click)="showAds()"> ShowAd</button>
  <button ion-button color="secondary" (click)="InterstitialAd()"> 
   InterstitialAd</button>

单击任何按钮时,它显示[object Promise],什么也没有显示。

需要帮助。

0 个答案:

没有答案