首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AdColony间隙广告不显示(Unity)

AdColony间隙广告不显示(Unity)
EN

Stack Overflow用户
提问于 2020-09-09 07:43:56
回答 1查看 1.2K关注 0票数 0

所以当我试图在我的设备上显示间质广告时,我遇到了一个问题。

请求间隙广告总是返回一个成功的消息,但当我试图调用显示功能时,什么也不会发生。

它只发生在间隙广告,因为横幅广告是工作和显示在设备上。

此外,AdColony仪表板接收新请求,但仍然显示函数不起作用:

我试过使用现场广告和测试广告。

我在用:

团结2020.1.4f1

外部依赖管理器1.2.156

AdColony 4.3.1

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

代码语言:javascript
复制
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");
    }
}

有办法解决这个问题吗?

EN

回答 1

Stack Overflow用户

发布于 2020-09-11 09:14:45

我终于让它起作用了!

为了展示广告,我需要解决三个问题。

  1. I将AndroidManifest.xml文件从Android/Plugin/AdColony移到Android/Plugin文件夹,因为只有在这个路径中,Unity才能读取清单文件。
  2. ,我又添加了一个默认的UnityAndroidManifest.xml文件中的活动。它修复了应用程序无法在设备上启动的错误。我将在这里附加我的全部AndroidManifest.xml代码.

代码语言:javascript
复制
<?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()函数的所有折旧代码.

现在间质广告运作得很好!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63806931

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档