I used to display AdMob banner on my future apps, and I'dl to give a try to the interstitial ads. I checked the AdMob SDK for implementation, and I copied their example source because it was exactly what I want (i.e. the insterstitial shown when the activity launch). I tried it on emulator and on my Galaxy, no ad has been displayed. Here is the source code.
public class Asscreed extends Activity {
private InterstitialAd interstitial;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_asscreed);
// Create the interstitial.
interstitial = new InterstitialAd(this);
interstitial.setAdUnitId("ca-app-pub-6046034785851961/xxxxxx");
// Create ad request.
AdRequest adRequest = new AdRequest.Builder().build();
// Begin loading your interstitial.
interstitial.loadAd(adRequest);
}
// Invoke displayInterstitial() when you are ready to display an interstitial.
public void displayInterstitial() {
if (interstitial.isLoaded()) {
interstitial.show();
}
}
}
The imports are ok and they googly play service library is of course imported. I use this example : https://developers.google.com/mobile-ads-sdk/docs/admob/advanced
Could someone tell me what's wrong in my code ?
Thanks in advance !