AdColony interstitial ads not showing(Unity Android)

1.4k views Asked by At

So I've faced with a problem when trying to show interstitial ads on my device.

Requesting interstitial ads always return a success message, but when I try to call show function, nothing happens.

It only happens with interstitial ads, because banner ads are working and showing on device.

Also, AdColony dashboard receives new requests, but still showing functions doesn't work: image

I've tried using both live and test ads.

I'm using:
Unity 2020.1.4f1
External Dependency Manager 1.2.156
AdColony 4.3.1

This is part of the code I'm trying to run:

AdColony.InterstitialAd _ad = null;

// Start is called before the first frame update
void Start()
{
    string[] zoneIds = new string[] { "myZoneID" };
    AdColony.Ads.Configure("myAppID", null, zoneIds);        

    AdColony.Ads.OnRequestInterstitial += (AdColony.InterstitialAd ad) => {
        _ad = ad;
    };

    AdColony.Ads.OnExpiring += (AdColony.InterstitialAd ad) => {
        AdColony.Ads.RequestInterstitialAd("myZoneID", null);
    };
}

public void Request()
{
    AdColony.Ads.RequestInterstitialAd("myZoneID", null);
}

public void Show()
{
    if (_ad != null) {
        AdColony.Ads.ShowAd(_ad);
    }
    else
    {
        Debug.Log("null");
    }
}

Is there any way to fix this problem?

1

There are 1 answers

1
MCTG On

Finally I've got it working!

So there were three problems that I needed to solve in order to show the ads.

  1. I moved the AndroidManifest.xml file from Android/Plugin/AdColony to Android/Plugin folder, because only in this path Unity can read manifest files.
  2. I've added one more activity that was in the default Unity AndroidManifest.xml file. It fixed the error where the app couldn't launch on the device. I will attach my whole AndroidManifest.xml code here.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.adcolony.unitypluginpackage">

    <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.INTERNET"/>


    <!-- OPTIONAL -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <!-- OPTIONAL -->
    <uses-permission android:name="android.permission.VIBRATE" />


    <application>
        <activity android:name="com.unity3d.player.UnityPlayerActivity"
                  android:theme="@style/UnityThemeSelector">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
        </activity>

        <activity android:name="com.adcolony.sdk.AdColonyInterstitialActivity" android:configChanges="keyboardHidden|orientation|screenSize" android:hardwareAccelerated="true"/>

        <activity android:name="com.adcolony.sdk.AdColonyAdViewActivity"
        android:configChanges="keyboardHidden|orientation|screenSize"
        android:hardwareAccelerated="true"/>
    </application>

</manifest>
  1. Commented all depreciated code from GameController script ConfigureAds() function.

0

And now interstitial ads are working perfectly!