Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Admob interstitial with audio

Tags:

I hope someone can give information about this. I display interstitial ads with Admob. Some of them have music or sounds and my users get terrible annoyed because of this. So, does anyone know if there is a way to block ads with music or sound? Is there anyway to decline access to the loud speaker for the ads? Thanks

like image 201
Ton Avatar asked Apr 06 '14 09:04

Ton


People also ask

How much do interstitial ads pay?

How much do interstitial ads pay? With the right implementation, and using playable and video interstitials, developers can reach $10-$20 eCPMs in tier 1 countries. The average eCPM for interstitial ads range from $4-$6.

How do I show interstitial advertising?

Show the ad Between levels of a game is a good example, or after the user completes a task. To show an interstitial, use the show() method. Log. d("TAG", "The interstitial ad wasn't ready yet.")

What is AdMob interstitial?

The AdMobInterstitial item allows monetizing your app with fullscreen interstitial ads on Android and iOS.

How many interstitial ads are there?

It is recommended to put not more than one interstitial ad after every two user actions within an app. Although this might also be too much for your users, so keep an eye on your retention rate.


2 Answers

I had the same issue. I was shocked to hear some audio in background too. This is what I did. Mute the sound before showing the ad. Unmute the sound onAdClosed() of AdListener. You can set the adListener on the interstitial ad while loading the ad.

private InterstitialAd interstitialAd; private void showTheAd(){     _muteSound();     interstitialAd.show(); }   private void loadAd(){     interstitialAd = new InterstitialAd(context);     interstitialAd.setAdUnitId("ca-app-pub-XXXXXXx/XXXXXXXX");     AdRequest adRequest = new AdRequest.Builder().addTestDevice(             AdRequest.DEVICE_ID_EMULATOR).build();     interstitialAd.loadAd(adRequest);     interstitialAd.setAdListener(new AdListener() {             public void onAdClosed(){                 _unmuteSound();             }         }); }  private void _unmuteSound(){     AudioManager aManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);                 aManager.setStreamMute(AudioManager.STREAM_MUSIC, false); } private void _muteSound(){     AudioManager aManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);                 aManager.setStreamMute(AudioManager.STREAM_MUSIC, true); } 
like image 194
Thupten Avatar answered Oct 24 '22 06:10

Thupten


to mute an ad, just call MobileAds.setAppmuted(true)

@Override protected void onCreate(Bundle savedInstanceState) {     super.onCreate(savedInstanceState);     setContentView(R.layout.activity_my);      // Set app volume to be half of current device volume.     MobileAds.setAppVolume(0.5f); // or setAppMuted(true); to mute      ... } 

from their forum page: https://groups.google.com/forum/#!topic/google-admob-ads-sdk/X7hQeehlJBI

The Google Mobile Ads SDK for Android has methods to set the current volume for incoming ads, based on the device's current volume level.

setAppVolume(float) - available in the Android AdMob SDK version 8.4 and up. setAppMuted(boolean) - available in the Android AdMob SDK version 9.0 and up.

for further readings, refer to https://developers.google.com/admob/android/global-settings and https://developers.google.com/android/reference/com/google/android/gms/ads/MobileAds

like image 23
Angel Koh Avatar answered Oct 24 '22 06:10

Angel Koh