import { platformNativeScriptDynamic, NativeScriptModule } from "nativescript-angular/platform"; import { NgModule } from "@angular/core"; import { AppComponent } from "./app.component"; import { admobModule } from "nativescript-admob"; @NgModule({ declarations: [AppComponent], bootstrap: [AppComponent], imports: [NativeScriptModule], }) class AppComponentModule { function createBanner() { admobModule.createBanner({ testing: true, size: admobModule.AD_SIZE.SMART_BANNER, androidBannerId: "ca-app-pub-4225186613160852/8357139706", margins: { bottom: 0 } }).then(function() { console.log("admob createBanner done"); }, function(error) { console.log("admob createBanner error: " + error); }); } function createInterstitial(){ admobModule.createInterstitial({ testing: true, androidInterstitialId: "ca-app-pub-4225186613160852/7938337306", }).then(function() { console.log("admob createInterstitial done"); }, function(error) { console.log("admob createInterstitial error: " + error); }); } function hideBanner () { admobModule.hideBanner().then(function() { console.log("admob hideBanner done"); }, function(error) { console.log("admob hideBanner error: " + error); }); } } platformNativeScriptDynamic().bootstrapModule(AppComponentModule);
tns plugin add nativescript-admob
/// <reference path="./node_modules/nativescript-admob/admob.d.ts"></reference>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)