0

我在 Unity 2017.2.0 项目中集成了 Admob 3.11.1。我想将 Vungle 5.3.2 添加为中介中的另一个网络。

  1. 我已经为 Vungle 的控制台配置了自定义插页式布局和奖励自定义布局。
  2. 成功将 Vungle 的展示位置参考添加到 Admob 控制台(作为新的广告源)。
  3. 将 Vungle 的 eCPM 配置为 100 美元,使其获得优先权。
  4. 导入 Admob 3.11.1 Unity 插件。
  5. 从 Android 导出导入 vungle .jar 并将它们放在 Plugins/Android 文件夹中。还尝试将它们放在 Plugins/Android/GoogleMobileAdsPlugin/libs 中。
  6. 添加了 Vungle 清单活动。

<application
    android:icon="@drawable/app_icon"
    android:label="@string/app_name"
	  android:theme="@android:style/Theme.NoTitleBar">
      <activity
		  android:label="@string/app_name"
		  android:screenOrientation="fullSensor"
		  android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
		  android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
      		  android:name="com.vungle.publisher.VideoFullScreenAdActivity">
      </activity>
      <activity android:name="com.vungle.publisher.MraidFullScreenAdActivity"
	    android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
	    android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
       <activity android:name="com.vungle.publisher.FlexViewAdActivity"
        android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
        android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
  </application>
  
  <uses-permission android:name="android.permission.INTERNET"/>
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
  <uses-permission
        android:name="android.permission.WRITE_EXTERNAL_STORAGE"
        android:maxSdkVersion="18"/>
  <uses-permissio
        android:name="android.permission.READ_EXTERNAL_STORAGE"
        android:maxSdkVersion="18" />

  1. 从脚本中加载奖励广告,如下所示:

RewardBasedVideoAd rewardBasedVideo = RewardBasedVideoAd.Instance;

// Create an empty ad request.
AdRequest.Builder builder = new AdRequest.Builder();
// Add simulator test as default
builder.AddTestDevice(AdRequest.TestDeviceSimulator);

rewardBasedVideo.LoadAd(builder.Build(), "admob-rewarded-placement");

  1. 我正在使用 proguard.. 所以我添加了 Vungle 的规则:

# Vungle

-dontwarn com.vungle.**
-dontnote com.vungle.**
-keep class com.vungle.** { *; }
-keep class javax.inject.*

-dontwarn de.greenrobot.event.util.**

-dontwarn rx.internal.util.unsafe.**
-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
   long producerIndex;
   long consumerIndex;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
   rx.internal.util.atomic.LinkedQueueNode producerNode;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {
   rx.internal.util.atomic.LinkedQueueNode consumerNode;
}
-keep class rx.schedulers.Schedulers { public static <methods>; }
-keep class rx.schedulers.ImmediateScheduler { public <methods>; }
-keep class rx.schedulers.TestScheduler { public <methods>; }
-keep class rx.schedulers.Schedulers { public static ** test(); }

-dontwarn com.moat.**
-keep class com.moat.** { public protected private *; }

-dontwarn okio.**
-dontwarn retrofit2.Platform$Java8

  1. 在 Plugins/Android 文件夹中添加了Admob 的 Vungle 适配器 .aar 。

当我想展示奖励广告时,我总是会得到 Admob 广告或 Unity 广告(它正在中介的另一个网络)。但我从来没有收到过 Vungle 广告。我可能会错过什么?

4

1 回答 1

0

I finally solved it. I was missing passing Vungle placement references when loading Admob ad.

RewardBasedVideoAd rewardBasedVideo = RewardBasedVideoAd.Instance;
GoogleMobileAds.Api.Mediation.Vungle.VungleRewardedVideoMediationExtras vungle = new GoogleMobileAds.Api.Mediation.Vungle.VungleRewardedVideoMediationExtras();
vungle.SetAllPlacements(new string[] { "REWARDED-78375", "INTERSTITIAL_INGAME-243547", "DEFAULT8623" });

// Create an empty ad request.
AdRequest.Builder builder = new AdRequest.Builder()
	.AddMediationExtras(vungle);

// Add simulator test as default
builder.AddTestDevice(AdRequest.TestDeviceSimulator);

rewardBasedVideo.LoadAd(builder.Build(), m_rewardedVideoId);

I was also missing Vungle extras package. You can get it on Vungle tutorial about integration with Admob Tutorial

于 2018-02-16T02:10:17.880 回答