Beispiel #1
0
 public static void Init(AdsConfiguration config, Action <string> onComplete = null)
 {
     if (inst == null)
     {
         DebugLog("AdsRequestHelper.Init()");
         try
         {
             DebugLog("MoPub.InitializeSdk()");
             if (onComplete != null)
             {
                 MoPubManager.OnSdkInitializedEvent += onComplete;
             }
             MoPubBase.SdkConfiguration sdkConfiguration = new MoPubBase.SdkConfiguration {
                 AdUnitId = config.mopubRewarded,
                 LogLevel = MoPubBase.LogLevel.MPLogLevelDebug
             };
             sdkConfiguration.MediatedNetworks = new MoPubBase.MediatedNetwork[] { new MoPubBase.SupportedNetwork.AdMob(), new MoPubBase.SupportedNetwork.AppLovin(), new MoPubBase.SupportedNetwork.Facebook(), new MoPubBase.SupportedNetwork.IronSource(), new MoPubBase.SupportedNetwork.Unity() };
             MoPubAndroid.InitializeSdk(sdkConfiguration);
             DebugLog("MoPub.LoadRewardedVideoPluginsForAdUnits()");
             string[] rewardedVideoAdUnitIds = new string[] { config.mopubRewarded };
             MoPubAndroid.LoadRewardedVideoPluginsForAdUnits(rewardedVideoAdUnitIds);
             Type[]     components = new Type[] { typeof(AdsRequestHelper) };
             GameObject target     = new GameObject("AdsHelperObject", components);
             Object.DontDestroyOnLoad(target);
             inst        = target.GetComponent <AdsRequestHelper>();
             inst.config = config;
         }
         catch (Exception exception)
         {
             Debug.LogException(exception);
         }
     }
 }
Beispiel #2
0
    public static void Init()
    {
        string str = string.Empty;

        str = "171f58958cd34cc79d891c222471ec79";
        if (!string.IsNullOrEmpty(str))
        {
            AdsConfiguration config = new AdsConfiguration {
                mopubRewarded = str
            };
            Init(config, null);
        }
    }