在Unity中与Admob调解的丛林

时间:2018-02-15 21:53:02

标签: unity3d admob vungle-ads

我在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 .jars并将它们放在Plugins / Android文件夹中。还尝试将它们放在Plugins / Android / GoogleMobileAdsPlugin / libs中。
  6. 添加了Vungle清单活动。
  7. <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. 从以下脚本加载奖励广告:
    2. 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的规则:
      2. # 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's Vungle adapter .aar
        2. 当我想要展示奖励广告时,我总是会收到Admob广告或Unity广告(其他网络正在调解)。但我从未收到过Vungle广告。 我能错过什么?

1 个答案:

答案 0 :(得分:0)

我终于解决了它。在加载Admob广告时,我错过了通过Vungle展示位置引用。

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

我也错过了Vungle extras包。您可以在Vungle教程中获取有关与Admob Tutorial

集成的内容