예제 #1
0
        /// <summary>
        /// Updates consent at runtime
        /// </summary>
        /// <param name="consent">the new consent</param>
        public void UpdateConsent(GDPRConsent consent)
        {
            if (consent == GDPRConsent.Accept || consent == GDPRConsent.Unset)
            {
                HeyzapAds.SetGdprConsent(true);
            }
            else
            {
                HeyzapAds.SetGdprConsent(false);
            }

            Debug.Log(this + " Update consent to " + consent);
            ScreenWriter.Write(this + " Update consent to " + consent);
        }
예제 #2
0
        /// <summary>
        /// Initializing Heyzap
        /// </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(GDPRConsent consent, List <PlatformSettings> platformSettings)
        {
            debug = Advertisements.Instance.debug;

            //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
            //apply settings
            publisherId = settings.appId.id;

            //verify settings
            if (debug)
            {
                Debug.Log(this + " Initialization Started");
                ScreenWriter.Write(this + " Initialization Started");
                Debug.Log(this + " Publisher ID: " + publisherId);
                ScreenWriter.Write(this + " Publisher ID: " + publisherId);
            }

            AdListeners();

            //preparing Heyzap SDK for initialization
            if (consent == GDPRConsent.Accept || consent == GDPRConsent.Unset)
            {
                HeyzapAds.SetGdprConsent(true);
            }
            else
            {
                HeyzapAds.SetGdprConsent(false);
            }

            if (settings.directedForChildren == true)
            {
                HeyzapAds.Start(publisherId, HeyzapAds.FLAG_CHILD_DIRECTED_ADS);
            }
            else
            {
                HeyzapAds.Start(publisherId, HeyzapAds.FLAG_NO_OPTIONS);
            }

            //start loading ads
            HZInterstitialAd.Fetch();
            HZIncentivizedAd.Fetch();
            //HeyzapAds.ShowMediationTestSuite();
        }