I am a noob in android studio. And I want to put an ad on multiple activities. Some say that it needs an admob fragment to make it possible. So can someone give me an example or source code for the banner admob fragment.
Asked
Active
Viewed 910 times
0

Yeldar Kurmangaliyev
- 33,467
- 12
- 59
- 101

israejumbo
- 11
- 2
-
large Banner ya small means 50 dp height ya large 240X320 dp banner size – Abhinav singh Sep 17 '15 at 06:29
-
I recommend you check the following get started guide: https://developers.google.com/admob/android/quick-start – narko Sep 17 '15 at 07:16
1 Answers
0
Add this code and show InterstitialAd in your activity in onCreate
InterstitialAd interAd = new InterstitialAd(this);
interAd.setAdUnitId("Add your adMob key");
requestNewInterstitial();
interAd.setAdListener(new AdListener() {
@Override
public void onAdLoaded() {
displayInterstitial();
}
});
public void displayInterstitial(){
if (interAd.isLoaded()){
interAd.show();
};
}
private void requestNewInterstitial() {
AdRequest adRequest = new AdRequest.Builder()
.build();
interAd.loadAd(adRequest);
}

Abhinav singh
- 1,448
- 1
- 14
- 31
-
Interstitials are not banners. And interstitials are never used with fragments as they appear fullscreen and not as part of a screen. You're not really answering the question. – Codo Sep 17 '15 at 06:05
-