Admob Interstitial Ads

 



Interstitial ads are full-screen ads that cover the interface of their host app. They're typically displayed at natural transition points in the flow of an app, such as between activities or during the pause between levels in a game. When an app shows an interstitial ad, the user has the choice to either tap on the ad and continue to its destination or close it and return to the app.

Prerequisites

• Download the latest admob sdk(local Libraries), components and blocks here.
• Add the following imports in your project.
import com.google.android.gms.ads.interstitial.InterstitialAd;
import com.google.android.gms.ads.interstitial.InterstitialAdLoadCallback;

NOTE:

Make sure you download the blocks,
components and Local Libraries.

Create an Interstitial Ad Variable

The first step towards display an Interstitial ad is by creating an Interstitial ad variable in your project.
Sorry that you will have to work with these method Sketchware Pro admob codes merge with the regular simple method so. 
The images and steps below illustrates how you can create a custom variable in Sketchware Pro


STEPS

1. Click on the highlighted button with name Add custom variable.


2. Enter your variable name for the InterstitialAd  (I am using mInterstialAd as my InterstitialAd variable name).
3 Click in add then you have just successfully created an InterstitialAd variable.

NOTE: you can only add these variable when you have added all the admob Local Libraries.

Test Ads

When building and testing your apps, make sure you use test ads rather than live, production ads. Failure to do so can lead to suspension of your account.

The easiest way to load test ads is to use our dedicated test ad unit ID for Android Interstitial ad:

ca-app-pub-3940256099942544/1033173712

It's been specially configured to return test ads for every request, and you're free to use it in your own apps while coding, testing, and debugging. Just make sure you replace it with your own ad unit ID before publishing your app.

For more information about how the Mobile Ads SDK's test ads work, see Test ads.


Once you have created the InterstitialAd variable the next step is to load an ad. The illustration below shows how you can load an ad in your activity ON CREATE.

Loads an Interstitial Ad



The FullScreenContentCallback handles events related to displaying your InterstitialAd. Before showing InterstitialAd, make sure to set the callback:


Interstitial ads should be displayed during natural pauses in the flow of an app. Between levels of a game is a good example, or after the user completes a task. To show an interstitial, use the show() method.
The screenshot below shows how you can show an Interstitial Ad in an activity.



NOTE:

- Make sure you download the blocks, components and localLibraries here.
- For better understanding, please refer to my YouTube Tutorial.
- Kindly subscribe to my YouTube channel here and make sure you join my Telegram channel to get Updates on my tutorials and projects Subscribe here.

Enjoy the tutorial

Comments

Popular posts from this blog

Implementing Google Admob Mobile Ads SDK (Android) in Sketchware without using Sketchware Admob Libraries