Although I have implemented com.google.android.gms.ads:20.0.0 in my project, still I am not able to use interstitialAd.setAdUnitId(), loadAd.
Here is what I have:

import androidx.multidex.BuildConfig; import com.google.android.gms.ads.Adlistener; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.IntersitialAd; import com.google.android.gms.ads.intersitital.IntersisitalAd; 

Here is where I'm trying to use the method:

public void interstitalLoadAd(Context context){     mInterstitialAd = new InterstitialAd(context);     mInterstitialAd.setAdUnitId(BuildConfig.DEBUG ?         TEST_INTERSTITIAL_AD_UNIT_ID :         INTERSTITIAL_AD_UNIT_ID);     mInterstitialAd.loadAd(new AdRequest.Builder().build());     mInterstitialAd.setAdListener(this); } public void showAd(){     if (mInterstitialAd.isLoaded()){         mInterstitialAd.show();  } 

Tag:google-ads-api, admob, android, java

Add a new comment.