AdColony插页式广告未展示Unity Android

问题描述

因此,当我尝试在设备上展示插页式广告时遇到了一个问题。

请求插页式广告总是会返回一条成功消息,但是当我尝试调用显示功能时,什么也没发生。

仅在插页式广告中会发生这种情况,因为横幅广告正在运行并在设备上显示。

此外,AdColony信息中心收到了新的请求,但仍无法显示功能:

image

我尝试同时使用实时广告和测试广告。

我正在使用:
Unity 2020.1.4f1
外部依赖管理器1.2.156
AdColony 4.3.1

这是我尝试运行的代码的一部分:

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");
    }
}

有什么办法可以解决此问题?

解决方法

最后我已经开始工作了!

因此,要展示广告,我需要解决三个问题。

  1. 我将AndroidManifest.xml文件从Android / Plugin / AdColony移到了Android / Plugin文件夹,因为只有在此路径下,Unity才能读取清单文件。
  2. 我还添加了另一个活动,该活动在默认的Unity AndroidManifest.xml文件中。它修复了无法在设备上启动应用程序的错误。我将在此处附加我的整个AndroidManifest.xml代码。
<?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. 评论了GameController脚本ConfigureAds()函数中所有折旧的代码。

0

现在,插页式广告可以正常运行!

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...