ionic4 admob plugin errores
Página de inicio ts código
import { PostsService } from "./../posts.service";
import { Component, OnInit } from "@angular/core";
import { Observable } from "rxjs";
import { Router } from "@angular/router";
import { ActivatedRoute, ParamMap } from "@angular/router";
import { switchMap } from "rxjs/operators";
import { AdMobFree, AdMobFreeBannerConfig } from '@ionic-native/admob-free';
@Component({
selector: "app-home",
templateUrl: "home.page.html",
styleUrls: ["home.page.scss"]
})
export class HomePage implements OnInit {
constructor(
private postSrvc: PostsService,
private router: Router,
private route: ActivatedRoute,
private admobFree: AdMobFree
) {
this.showBannerAd();
}
posts$: Observable<any>;
loadPost(post: any) {
this.router.navigate(["/posts", post.id]);
}
ngOnInit() {
this.posts$ = this.route.paramMap.pipe(
switchMap(
(params: ParamMap) =>
params.get("category")
? this.postSrvc.fetchPostsByCategory(params.get("category"))
: this.postSrvc.fetchPosts()
)
);
}
async showBannerAd() {
try {
const bannerConfig: AdMobFreeBannerConfig = {
id: 'unit id',
isTesting: true,
autoShow: true
}
this.adMobFree.banner.config(bannerConfig);
const result = await this.adMobFree.banner.prepare();
console.log(result);
}
catch (e) {
console.error(e);
}
}
}
módulo app ts código
import { HttpClientModule } from "@angular/common/http";
import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { RouteReuseStrategy } from "@angular/router";
import { SplashScreen } from "@ionic-native/splash-screen/ngx";
import { StatusBar } from "@ionic-native/status-bar/ngx";
import { IonicModule, IonicRouteStrategy } from "@ionic/angular";
import { AppRoutingModule } from "./app-routing.module";
import { AppComponent } from "./app.component";
import { AdMobFree } from '@ionic-native/admob-free';
@NgModule({
declarations: [AppComponent],
entryComponents: [],
imports: [
BrowserModule,
IonicModule.forRoot(),
AppRoutingModule,
HttpClientModule
],
providers: [
StatusBar,
SplashScreen,
AdMobFree,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
],
bootstrap: [AppComponent]
})
export class AppModule {}
todos los Errores
[ng] ERROR en src/app/app.el módulo.ts(13,11): error TS2345: Argumento de tipo '{ declaraciones: (typeof AppComponent)[]; entryComponents: undefined[]; importación: (ModuleWithProvid...' no asignables a los parámetros de tipo 'NgModule'.
[ng] Tipos de propiedad "proveedores" son incompatibles.
[ng] Tipo '(typeof SplashScreen | AdMobFreeOriginal | { proporcionar: typeof RouteReuseStrategy; useClass: typeof...' no es asignable a tipo de Profesional' []'.
[ng] Tipo 'typeof SplashScreen | AdMobFreeOriginal | { proporcionar: typeof RouteReuseStrategy; useClass: typeof ...' no es asignable tipo de 'Proveedor'.
[ng] Tipo 'AdMobFreeOriginal' no es asignable tipo de 'Proveedor'.
[ng] Tipo 'AdMobFreeOriginal' no es asignable al tipo 'ClassProvider'.
[ng] Propiedad 'proporcionar' falta en el tipo 'AdMobFreeOriginal'.
[ng] src/app/home/home.página.ts(19,24): error TS2304: No se puede encontrar el nombre de 'AdMobFree'.
[ng] src/app/home/home.página.ts(48,12): error TS2551: la Propiedad 'adMobFree' no existe en el tipo 'página de inicio'. Did you mean 'admobFree'?
[ng] src/app/home/home.página.ts(50,33): error TS2551: la Propiedad 'adMobFree' no existe en el tipo 'página de inicio'. Did you mean 'admobFree'?