Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Latest commit

 

History

History
81 lines (59 loc) · 2.28 KB

Interstitial.md

File metadata and controls

81 lines (59 loc) · 2.28 KB

Interstitial

firebase.admob.interstitial

An interstitial is a full screen advert which creates a new activity on top of React. As they need to be controlled, allowing the developer to choose when to display them they're not available as a component. Instead they're controlled via method calls. A single interstitial instance can only be shown once. If you want to display another, create a new one.

Methods

loadAd

[method]loadAd(request) returns void;[/method]

Starting loading an interstial from the Firebase servers with a given [ref admob.AdRequest#build] payload.

Parameter
request [ref admob.AdRequest#build]
An AdRequest.build object

on

[method]on(event, callback) returns void;[/method]

Listens for advert events. See [EventTypes](version /admob/reference#eventtypes) for more information.

Parameter
event [ref admob#EventTypes]
A single event type
callback function

isLoaded

[method]isLoaded() returns boolean;[/method]

Returns whether the current requested advert has loaded from the Firebase servers.

show

[method]show() returns void;[/method]

Shows the loaded advert on the device.

Example

const advert = firebase.admob().interstitial('ca-app-pub-3940256099942544/1033173712');

const AdRequest = firebase.admob.AdRequest;
const request = new AdRequest();
request.addKeyword('foo').addKeyword('bar');

// Load the advert with our AdRequest
advert.loadAd(request.build());

advert.on('onAdLoaded', () => {
  console.log('Advert ready to show.');
});

// Simulate the interstitial being shown "sometime" later during the apps lifecycle
setTimeout(() => {
  if (advert.isLoaded()) {
    advert.show();
  } else {
    // Unable to show interstitial - not loaded yet.
  }
}, 1000);

For test in mode debug you need use codes

Banner

ca-app-pub-3940256099942544/6300978111

Interstitial

ca-app-pub-3940256099942544/1033173712

Interstitial Video

ca-app-pub-3940256099942544/8691691433

Rewarded Video

ca-app-pub-3940256099942544/5224354917

Native Advanced

ca-app-pub-3940256099942544/2247696110

Native Advanced Video

ca-app-pub-3940256099942544/1044960115

https://developers.google.com/admob/android/test-ads