Beispiel #1
0
        protected IEnumerator InitMoPubSdkCoroutine()
        {
            bool initResult = mAdSettings.UseAdvancedSetting ? AdvancedInit() : NormalInit();

            if (!initResult)
            {
                Debug.LogError("Failed to initialize MoPub.");
                yield break;
            }
            yield return(new WaitUntil(() => MoPub.IsSdkInitialized));

            // Apply GDPR consent (if any) *after* the SDK is initialized
            // (the MoPub's grant and revoke methods internally check if the SDK is initialized).
            var consent = GetApplicableDataPrivacyConsent();

            ApplyDataPrivacyConsent(consent);

            LoadAllAdUnits();

            if (mAdSettings.ReportAppOpen)
            {
                #if UNITY_IOS
                MoPub.ReportApplicationOpen(mAdSettings.ITuneAppID);
                #elif UNITY_ANDROID
                MoPub.ReportApplicationOpen();
                #endif
            }

            MoPub.EnableLocationSupport(mAdSettings.EnableLocationPassing);
        }
Beispiel #2
0
 void Start()
 {
     if (Instance == this && AutoInitializeOnStart && !MoPub.IsSdkInitialized)
     {
         MoPub.ReportApplicationOpen(itunesAppId);
         MoPub.EnableLocationSupport(LocationAware);
         MoPub.InitializeSdk(SdkConfiguration);
         MoPub.SetEngineInformation();
     }
 }
    void Start()
    {
        if (Instance != this || !AutoInitializeOnStart || MoPub.IsSdkInitialized)
        {
            return;
        }

        MoPub.InitializeSdk(SdkConfiguration);
        MoPub.ReportApplicationOpen(itunesAppId);
        MoPub.EnableLocationSupport(LocationAware);
    }
Beispiel #4
0
    private void CreateActionsSection()
    {
        GUILayout.Space(_sectionMarginSize);
        GUILayout.Label("Actions");
        if (GUILayout.Button("Report App Open")) {
            ClearStatusLabel();
            MoPub.ReportApplicationOpen();
        }

        if (!GUILayout.Button("Enable Location Support")) return;

        ClearStatusLabel();
        MoPub.EnableLocationSupport(true);
    }
Beispiel #5
0
        protected override bool DoAdapterInit(SDKConfig config, SDKAdapterConfig adapterConfig)
        {
            m_Config = adapterConfig as MoPubAdsConfig;
#if UNITY_ANDROID
            string appId = m_Config.appIDAndroid;
#elif UNITY_IPHONE
            string appId = m_Config.appIDIos;
#else
            string appId = "unexpected_platform";
#endif

            string adUnit = m_Config.anyAdUnit;

            MoPub.InitializeSdk(new MoPubBase.SdkConfiguration
            {
                AdUnitId        = adUnit,
                AdvancedBidders = new MoPub.AdvancedBidder[] {
                    MoPub.AdvancedBidder.AppLovin,
                    MoPub.AdvancedBidder.Unity,
                    MoPub.AdvancedBidder.AdMob,
                    MoPub.AdvancedBidder.Facebook
                },
                NetworksToInit = new MoPub.RewardedNetwork[] {
                    MoPub.RewardedNetwork.Unity,
                    MoPub.RewardedNetwork.Facebook,
                    MoPub.RewardedNetwork.AppLovin,
                    MoPub.RewardedNetwork.AdMob
                },
                MediationSettings = new MoPubBase.MediationSetting[] {
                }
            });

            MoPub.ReportApplicationOpen(appId);

            return(true);
        }