如果要使AdMob插屏广告有声音,可以通过设置广告的音量来实现。以下是使用Google Mobile Ads SDK for Android的示例代码:
InterstitialAd interstitialAd = new InterstitialAd(this); interstitialAd.setAdUnitId("your_ad_unit_id"); interstitialAd.loadAd(new AdRequest.Builder().build()); interstitialAd.setAdListener(new AdListener() { @Override public void onAdLoaded() { interstitialAd.show(); interstitialAd.setVolume(1); } });
在loadAd()方法之后,我们设置了广告的监听器,并在onAdLoaded()回调方法中显示了广告和将音量设置为1,表示最大音量。这样即可使AdMob插屏广告有声音。