Exemplo n.º 1
0
        /// <summary>
        /// Initializing AppLovin
        /// </summary>
        /// <param name="consent">user consent -> if true show personalized ads</param>
        /// <param name="platformSettings">contains all required settings for this publisher</param>
        public void InitializeAds(UserConsent consent, UserConsent ccpaConsent, List <PlatformSettings> platformSettings)
        {
            debug = Advertisements.Instance.debug;
            if (initialized == false)
            {
                if (debug)
                {
                    AppLovin.SetVerboseLoggingOn("true");
                }

                //get settings
#if UNITY_ANDROID
                PlatformSettings settings = platformSettings.First(cond => cond.platform == SupportedPlatforms.Android);
#endif
#if UNITY_IOS
                PlatformSettings settings = platformSettings.First(cond => cond.platform == SupportedPlatforms.iOS);
#endif

                //preparing AppLovin SDK for initialization
                Debug.Log("APPID: " + settings.appId.id.ToString());
                AppLovin.SetSdkKey(settings.appId.id.ToString());

                if (consent == UserConsent.Accept || consent == UserConsent.Unset)
                {
                    AppLovin.SetHasUserConsent("true");
                }
                else
                {
                    AppLovin.SetHasUserConsent("false");
                }


                if (settings.directedForChildren == true)
                {
                    AppLovin.SetIsAgeRestrictedUser("true");
                }
                else
                {
                    AppLovin.SetIsAgeRestrictedUser("false");
                }

                AppLovin.InitializeSdk();
                AppLovin.SetUnityAdListener(gameObject.name);

                if (debug)
                {
                    Debug.Log(this + " " + "Start Initialization");
                    ScreenWriter.Write(this + " " + "Start Initialization");
                    Debug.Log(this + " SDK key: " + settings.appId.id);
                    ScreenWriter.Write(this + " SDK key: " + settings.appId.id);
                }

                //start loading ads
                PreloadInterstitial();
                PreloadRewardedVideo();

                initialized = true;
            }
        }
Exemplo n.º 2
0
 public void GDPRAcceptance()
 {
     //#if !UNITY_EDITOR
     AppLovin.SetHasUserConsent(true);
     Tapjoy.SetUserConsent("1");
     //UnityAds.SetGDPRConsentMetaData(true);
     Vungle.UpdateConsentStatus(VungleConsent.ACCEPTED);
     IronSource.SetConsent(true);
     //#endif
 }
Exemplo n.º 3
0
 /// <summary>
 /// Updates consent at runtime
 /// </summary>
 /// <param name="consent">the new consent</param>
 public void UpdateConsent(UserConsent consent, UserConsent ccpaConsent)
 {
     if (consent == UserConsent.Accept || consent == UserConsent.Unset)
     {
         AppLovin.SetHasUserConsent("true");
     }
     else
     {
         AppLovin.SetHasUserConsent("false");
     }
 }
Exemplo n.º 4
0
        protected override void ApplyDataPrivacyConsent(ConsentStatus consent)
        {
#if EM_APPLOVIN
            switch (consent)
            {
            case ConsentStatus.Granted:
                AppLovin.SetHasUserConsent("true");
                break;

            case ConsentStatus.Revoked:
                AppLovin.SetHasUserConsent("false");
                break;

            case ConsentStatus.Unknown:
            default:
                break;
            }
#endif
        }
        /// <summary>
        /// Initialize.
        /// </summary>
        public void Initialize(Action onCompleteCallback = null)
        {
#if DEBUG_MY_ADMOB
            Debug.Log("[" + typeof(MyAdMobManager).Name + "] Initialize()");
#endif

            if (mTestEnable && mTestDeviceId.Length > 0)
            {
                if (mTestUseGoogleAdsId)
                {
                    mAndroidDefaultBannerId         = "ca-app-pub-3940256099942544/6300978111";
                    mAndroidDefaultInterstitialAdId = "ca-app-pub-3940256099942544/1033173712";
                    mAndroidDefaultRewardedAdId     = "ca-app-pub-3940256099942544/5224354917";

                    mIosDefaultBannerId         = "ca-app-pub-3940256099942544/2934735716";
                    mIosDefaultInterstitialAdId = "ca-app-pub-3940256099942544/4411468910";
                    mIosDefaultRewardedAdId     = "ca-app-pub-3940256099942544/1712485313";

#if UNITY_ANDROID
                    PlayerPrefs.SetString("MyAdMobManager_BannerId", mAndroidDefaultBannerId);
                    PlayerPrefs.SetString("MyAdMobManager_InterstitialAdId", mAndroidDefaultInterstitialAdId);
                    PlayerPrefs.SetString("MyAdMobManager_RewardedAdId", mAndroidDefaultRewardedAdId);
#elif UNITY_IOS
                    PlayerPrefs.SetString("MyAdMobManager_BannerId", mIosDefaultBannerId);
                    PlayerPrefs.SetString("MyAdMobManager_InterstitialAdId", mIosDefaultInterstitialAdId);
                    PlayerPrefs.SetString("MyAdMobManager_RewardedAdId", mIosDefaultRewardedAdId);
#endif
                }

                List <string> deviceIds = new List <string>();
                deviceIds.AddRange(mTestDeviceId.Split(';'));
                RequestConfiguration requestConfiguration = new RequestConfiguration.Builder().SetTestDeviceIds(deviceIds).build();
                MobileAds.SetRequestConfiguration(requestConfiguration);
            }

            MobileAds.Initialize(initStatus =>
            {
#if DEBUG_MY_ADMOB
                Debug.Log("[" + typeof(MyAdMobManager).Name + "] Initialize(): completed");
#endif

                mIsInitialized = true;

                if (onCompleteCallback != null)
                {
                    onCompleteCallback();
                }
            });

#if USE_MY_ADMOB_APPLOVIN
            AppLovin.Initialize();
            AppLovin.SetHasUserConsent(true);
#endif

#if USE_MY_ADMOB_MOPUB
            MoPub.InitializeSdk("8c09b6f2cb324838acf2fdad6899f5a8");
#endif

#if USE_MY_ADMOB_UNITY_ADS
            UnityAds.SetGDPRConsentMetaData(true);
#endif

#if USE_MY_ADMOB_VUNGLE
            Vungle.UpdateConsentStatus(VungleConsent.ACCEPTED);
#endif
        }