Skip to content

Instantly share code, notes, and snippets.

@BernardoGO
Last active November 2, 2016 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BernardoGO/66038754a8ffbe365cf96b34afef9880 to your computer and use it in GitHub Desktop.
Save BernardoGO/66038754a8ffbe365cf96b34afef9880 to your computer and use it in GitHub Desktop.
AdMob Ad visible onLoad
//Add the following imports to the activity code
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
//Add to the onCreate method
final AdView mAdView = (AdView) findViewById(R.id.adView); ///AD ID
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
mAdView.setAdListener(new AdListener() {
@Override
public void onAdLoaded() {
mAdView.setVisibility(View.VISIBLE);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment