Audio Ads

Enhance your app's monetization potential with InMobi's cutting-edge Audio Ads feature. With InMobi's SDK support for Audio Ads, you can seamlessly integrate high-quality, targeted audio advertisements into your app's audio content. Engage your users with relevant and captivating audio messages that fit seamlessly within their experience.

Set up InMobi Unity Package

Click here to download the InMobi Unity Package, which you can import as a Custom Package into your project.

Note

Ensure that you possess compatible versions to utilize InMobi Audio Icons. For iOS, the version should be 10.5.6 or before; for Android, the version should be 10.5.7 or later.

Set up Audio Ad

  1. From the left navigation, select Inventory Inventory Settings.
  2. Search for the app or website you would like to create a placement for and click + Add a placement.
  3. Click Select Ad Unit and select Audio Icon.
  4. Click Add a placement to start setting up your Audio settings. After you create the audio placement, you can see the placement ID.

Add Audio Ad to Your App

Add An Audio Slot in Code

  1. Place the AudioIconPlugin prefab within your game scene to display the audio ad's desired location. You can use a placeholder icon to align the advertisement within the editor.
  2. Enter Placement id in the inspector.
  3. Maintain the advertisement size at 70 x 70, the recommended dimension.
  4. Attach the provided InMobiAudioController script to the prefab and then pass the reference for the Audio Icon Plugin.

Initialize Plugin

Initiate the Plugin to guarantee the InMobi SDK's initialization and the listeners' attachment. We recommend temporarily deactivating your game's music (if applicable) while the ad is playing and resuming it once the audio ad concludes, utilizing the OnAudioStatusChanged event.

using System; 
using UnityEngine; 
using InMobi.Ads; 

public class InMobiAudioController : MonoBehaviour 
{ 

    private const string ACCOUNT_ID = "YOUR_INMOBI_ACCOUNT_ID"; 

    public static InMobiAudioController instance = null; 

    public AudioIconPlugin AudioIconPlugin; 

    private void Awake() 
    { 
        if (instance == null) 
        { 
            instance = this; 
            DontDestroyOnLoad(gameObject); 
            AttachAudioListeners(); 
        } 
        else 
        { 
            Destroy(this); 
        } 
    } 

    private void Start() 
    { 
        InMobiPlugin.Init(ACCOUNT_ID); 
    } 
    private void AttachAudioListeners() 
    { 
        AudioIconPlugin.OnAdLoadSucceeded += delegate (object sender, AdMetaInfo adMetaInfo) 
        { 
  isAudioAdReady = true; 
        }; 

        AudioIconPlugin.OnAudioStatusChanged += delegate (object sender, AdAudioStatusEventArgs e) { 
            if (e.AudioStatus == AudioStatus.PLAYING) 
            { 
                // toggle off background music 
            } 
            else if (e.AudioStatus == AudioStatus.COMPLETED || e.AudioStatus == AudioStatus.PAUSED) 
            { 
                // toggle background music on again 
            } 
        }; 
    }

Load Audio Ad

To request an audio ad, call the load() method on the InMobiAudio instance:

public void LoadAudioAd() 
    { 
        if (AudioIconPlugin != null) 
        { 
            AudioIconPlugin.LoadAd(); 
        } 
    }

Show Audio Ad

To show an audio ad after a successful load, call ShowAd().

if(isAudioAdReady){ 
AudioIconPlugin.ShowAd(); 
}

Integrate Rewarded Audio Icons

Add Rewarded Audio Ad to Your App

The implementation for Rewarded Audio Icon ads closely resembles that of Audio Icons.

You are expected to present a prompt to users, seeking their opt-in prior to displaying the rewarded audio icon ad. The InMobi SDK also offers the onRewardsUnlocked event for Rewarded ads. However, you can retain the flexibility to determine the timing of user rewards using various event callbacks.

AudioIconPlugin.OnAdRewardActionCompleted += delegate (object sender, AdRewardActionCompletedEventArgs e) { 
        Debug.Log("[InMobi-Unity] OnAdRewardActionCompleted " + e.Rewards); 
// pass rewards to the user 
      };

Test Integration

Using sandbox ads, you can assess the placement and refine the user experience. This involves configuring the placement in Test Mode, setting it as 'Global' within the placement settings. It's important to ensure that you set the device volume to a sufficient level to ensure ad playback.

For those employing manual SDK integration, it's imperative to initialize the InMobi SDK within the mediation debugger to ensure seamless operation and accurate evaluation.

On This Page

Last Updated on: 24 Aug, 2023