javaandroidadviewadmob

How to check if adview currently has ad running?


I currently have an adView that is launched whenever an activity is launched. I'd like to check if that adView already has an Ad running and if it does then it continues running that Ad , however, if it does not have an Ad running then I would like to load and Ad intho that adView.

This is the code currently:

private AdView mAdView;

mAdView = (AdView)view.findViewById(R.id.adViewEvent);
        AdRequest adRequest = new AdRequest.Builder().build();
        mAdView.loadAd(adRequest);

Solution

  •     adView.isShown();
    

    this method return the status of ad whether it is showing to user or not you can use this. method in if else structure

    if(!adView.isShown())
    {
    AdRequest adRequest = new AdRequest.Builder().build();
        mAdView.loadAd(adRequest);
    }