Beispiel #1
0
        /// <summary>
        /// Sets User's consent data under GDPR. Heyzap SDK will use this information to provide optimal targeted advertising without infringing GDPR.
        /// </summary>
        /// <param name="gdprConsentData">xA Dictionary of key-value pairs containing GDPR related information</param>
        static public void SetGdprConsentData(Dictionary <string, string> gdprConsentData)
        {
            #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE)
            string gdprConsentDataAsJsonString = null;
            if (gdprConsentData != null)
            {
                Dictionary <string, string> validatedGdprConsentData = new Dictionary <string, string>();
                foreach (KeyValuePair <string, string> entry in gdprConsentData)
                {
                    if (entry.Value != null)
                    {
                        validatedGdprConsentData.Add(entry.Key, entry.Value);
                    }
                }
                gdprConsentDataAsJsonString = GetGdprConsentDataAsJsonString(validatedGdprConsentData);
            }

                #if UNITY_ANDROID
            HeyzapAdsAndroid.SetGdprConsentData(gdprConsentDataAsJsonString);
                #elif UNITY_IPHONE
            HeyzapAdsIOS.SetGdprConsentData(gdprConsentDataAsJsonString);
                #endif
            #else
            UnityEngine.Debug.LogWarning("Call received to set the GDPR consent data, but the SDK does not function in the editor. You must use a device/emulator to set the GDPR consent data.");
            #endif
        }
 /// <summary>
 /// Unpauses expensive work, like ad fetches. Only relevant after a call to PauseExpensiveWork().
 /// </summary>
 public static void ResumeExpensiveWork()
 {
     #if UNITY_IPHONE && !UNITY_EDITOR
     HeyzapAdsIOS.ResumeExpensiveWork();
     #elif UNITY_ANDROID && !UNITY_EDITOR
     HeyzapAdsAndroid.ResumeExpensiveWork();
     #endif
 }
Beispiel #3
0
        /// <summary>
        /// (iOS only currently) Disables verbose debug logging for all the mediated SDKs we can.
        /// Only some networks' logs will be turned off, since some SDK implementations only consider this parameter when initialized.
        /// </summary>
        public static void HideThirdPartyDebugLogs()
        {
            #if UNITY_ANDROID
            #endif

            #if UNITY_IPHONE && !UNITY_EDITOR
            HeyzapAdsIOS.HideThirdPartyDebugLogs();
            #endif
        }
Beispiel #4
0
        /// <summary>
        /// Shows the mediation test suite.
        /// </summary>
        public static void ShowMediationTestSuite()
        {
            #if UNITY_ANDROID
            HeyzapAdsAndroid.ShowMediationTestSuite();
            #endif

            #if UNITY_IPHONE && !UNITY_EDITOR
            HeyzapAdsIOS.ShowMediationTestSuite();
            #endif
        }
Beispiel #5
0
 /// <summary>
 /// Returns the remote data you've set on the Heyzap Dashboards, which will be a JSON dictionary in string format.
 /// </summary>
 public static string GetRemoteData()
 {
     #if UNITY_ANDROID
     return(HeyzapAdsAndroid.GetRemoteData());
     #elif UNITY_IPHONE && !UNITY_EDITOR
     return(HeyzapAdsIOS.GetRemoteData());
     #else
     return("{}");
     #endif
 }
Beispiel #6
0
 /// <summary>
 /// Returns whether or not the given network has been initialized by Heyzap yet.
 /// </summary>
 /// <returns><c>true</c> if is network initialized the specified network; otherwise, <c>false</c>.</returns>
 /// <param name="network">The name of the network in question. Use the strings in HeyzapAds.Network to ensure the name matches what we expect.</param>
 public static Boolean IsNetworkInitialized(string network)
 {
     #if UNITY_ANDROID
     return(HeyzapAdsAndroid.IsNetworkInitialized(network));
     #elif UNITY_IPHONE && !UNITY_EDITOR
     return(HeyzapAdsIOS.IsNetworkInitialized(network));
     #else
     return(false);
     #endif
 }
Beispiel #7
0
        /// <summary>
        /// Hides all debug logs coming from the Heyzap SDK.
        /// </summary>
        public static void HideDebugLogs()
        {
            #if UNITY_ANDROID
            HeyzapAdsAndroid.HideDebugLogs();
            #endif

            #if UNITY_IPHONE && !UNITY_EDITOR
            HeyzapAdsIOS.HideDebugLogs();
            #endif
        }
Beispiel #8
0
 /// <summary>
 /// (Android only) Call this method in your back button pressed handler to make sure the back button does what the user should expect when ads are showing.
 /// </summary>
 /// <returns><c>true</c>, if Heyzap handled the back button press (in which case your code should not do anything else), and <c>false</c> if Heyzap did not handle the back button press (in which case your app may want to do something).</returns>
 public static Boolean OnBackPressed()
 {
     #if UNITY_ANDROID
     return(HeyzapAdsAndroid.OnBackPressed());
     #elif UNITY_IPHONE && !UNITY_EDITOR
     return(HeyzapAdsIOS.OnBackPressed());
     #else
     return(false);
     #endif
 }
 /// <summary>
 /// Set the bundle ID (i.e.: `com.name.of.company.and.app`) on Android and iOS to something other than what you have set in the Unity Editor's Player Settings menu.
 /// Note: This method MUST be called BEFORE calling `Start` on the SDK.
 /// This method is mostly useful for debugging purposes; for instance, you might use this to use a test account & bundle ID on debug builds.
 /// </summary>
 /// <param name="bundleID">The new bundle ID you want to use. This is how we link this app to your dashboard account on developers.heyzap.com .</param>
 public static void SetBundleIdentifier(string bundleID)
 {
     #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE)
         #if UNITY_ANDROID
     HeyzapAdsAndroid.SetBundleIdentifier(bundleID);
         #elif UNITY_IPHONE
     HeyzapAdsIOS.SetBundleIdentifier(bundleID);
         #endif
     #else
     #endif
 }
 /// <summary>
 /// Hides all debug logs coming from the Heyzap SDK. For third party logging, <see cref="HideThirdPartyDebugLogs()"/>.
 /// </summary>
 public static void HideDebugLogs()
 {
     #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE)
         #if UNITY_ANDROID
     HeyzapAdsAndroid.HideDebugLogs();
         #elif UNITY_IPHONE
     HeyzapAdsIOS.HideDebugLogs();
         #endif
     #else
     #endif
 }
Beispiel #11
0
 /// <summary>
 /// Sets User's consent under GDPR. Fyber will only be able to show targeted advertising if the user consented. Only call this method if the user explicitly gave or denied consent.
 /// </summary>
 /// <param name="isGdprConsentGiven">true if user gave consent to receive targeted advertisement, false otherwise</param>
 public static void SetGdprConsent(Boolean isGdprConsentGiven)
 {
     #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE)
         #if UNITY_ANDROID
     HeyzapAdsAndroid.SetGdprConsent(isGdprConsentGiven);
         #elif UNITY_IPHONE
     HeyzapAdsIOS.SetGdprConsent(isGdprConsentGiven);
         #endif
     #else
     UnityEngine.Debug.LogWarning("Call received to set the GDPR consent, but the SDK does not function in the editor. You must use a device/emulator to set the GDPR consent.");
     #endif
 }
 /// <summary>
 /// Shows the mediation test suite.
 /// </summary>
 public static void ShowMediationTestSuite()
 {
     #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE)
         #if UNITY_ANDROID
     HeyzapAdsAndroid.ShowMediationTestSuite();
         #elif UNITY_IPHONE
     HeyzapAdsIOS.ShowMediationTestSuite();
         #endif
     #else
     UnityEngine.Debug.LogWarning("Call received to show the Heyzap SDK test suite, but the SDK does not function in the editor. You must use a device/emulator to use the test suite.");
     #endif
 }
Beispiel #13
0
 /// <summary>
 /// Clears all GDPR related information. This means removing any GDPR consent Data and restoring the GDPR consent to "unknown"
 /// </summary>
 static public void ClearGdprConsentData()
 {
     #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE)
         #if UNITY_ANDROID
     HeyzapAdsAndroid.ClearGdprConsentData();
         #elif UNITY_IPHONE
     HeyzapAdsIOS.ClearGdprConsentData();
         #endif
     #else
     UnityEngine.Debug.LogWarning("Call received to clear the GDPR consent data, but the SDK does not function in the editor. You must use a device/emulator to set the GDPR consent data.");
     #endif
 }
 /// <summary>
 /// Returns the remote data you've set on the Heyzap Dashboards, which will be a JSON dictionary in string format.
 /// </summary>
 public static string GetRemoteData()
 {
     #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE)
         #if UNITY_ANDROID
     return(HeyzapAdsAndroid.GetRemoteData());
         #elif UNITY_IPHONE
     return(HeyzapAdsIOS.GetRemoteData());
         #endif
     #else
     UnityEngine.Debug.LogWarning("Call received to retrieve remote data from the Heyzap SDK, but the SDK does not function in the editor. You must use a device/emulator to use the remote data feature.");
     return("{}");
     #endif
 }
Beispiel #15
0
        /// <summary>
        /// Starts the Heyzap SDK. Call this method as soon as possible in your app to ensure Heyzap has time to initialize before you want to show an ad.
        /// </summary>
        /// <param name="publisher_id">Your publisher ID. This can be found on your Heyzap dashboards - see https://developers.heyzap.com/docs/unity_sdk_setup_and_requirements for more information.</param>
        /// <param name="options">A bitmask of options you can pass to this call to change the way Heyzap will work.</param>
        public static void Start(string publisher_id, int options)
        {
            #if !UNITY_EDITOR
            #if UNITY_ANDROID
            HeyzapAdsAndroid.Start(publisher_id, options);
            #endif

            #if UNITY_IPHONE
            HeyzapAdsIOS.Start(publisher_id, options);
            #endif

            HeyzapAds.InitReceiver();
            HZInterstitialAd.InitReceiver();
            HZIncentivizedAd.InitReceiver();
            HZBannerAd.InitReceiver();
            #endif
        }
Beispiel #16
0
        /// <summary>
        /// Starts the Heyzap SDK. Call this method as soon as possible in your app to ensure Heyzap has time to initialize before you want to show an ad.
        /// </summary>
        /// <param name="publisher_id">Your publisher ID. This can be found on your Heyzap dashboards - see https://developers.heyzap.com/docs/unity_sdk_setup_and_requirements for more information.</param>
        /// <param name="options">A bitmask of options you can pass to this call to change the way Heyzap will work.</param>
        public static void Start(string publisher_id, int options)
        {
            #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE)
                #if UNITY_ANDROID
            HeyzapAdsAndroid.Start(publisher_id, options);
                #elif UNITY_IPHONE
            HeyzapAdsIOS.Start(publisher_id, options);
                #endif
            #else
            UnityEngine.Debug.LogError("Call received to start the Heyzap SDK, but the SDK does not function in the editor. You must use a device/emulator to receive/test ads.");
            #endif

            HeyzapAds.InitReceiver();
            HZInterstitialAd.InitReceiver();
            HZVideoAd.InitReceiver();
            HZIncentivizedAd.InitReceiver();
            HZBannerAd.InitReceiver();
            HZDemographics.InitReceiver();
        }
 /// <summary>
 /// (iOS only currently) Enables verbose debug logging for all the mediated SDKs we can.
 /// You should call this method before starting the Heyzap SDK if you wish to enable these logs, since some SDK implementations only consider this parameter when initialized.
 /// </summary>
 public static void ShowThirdPartyDebugLogs()
 {
     #if UNITY_IPHONE && !UNITY_EDITOR
     HeyzapAdsIOS.ShowThirdPartyDebugLogs();
     #endif
 }
Beispiel #18
0
 /// <summary>
 /// (iOS only) Pauses expensive work, like ad fetches, until ResumeExpensiveWork() is called. Note that calling this method will affect ad availability.
 /// </summary>
 public static void PauseExpensiveWork()
 {
     #if UNITY_IPHONE && !UNITY_EDITOR
     HeyzapAdsIOS.PauseExpensiveWork();
     #endif
 }
 /// <summary>
 /// Adds the device as a Facebook Audience Network test device, allowing you to receive test ads when FAN would otherwise not give you fill. This API is only supported on iOS.
 /// </summary>
 /// <param name="device_id">The Device ID that FAN prints to the iOS console</param>
 public static void AddFacebookTestDevice(string device_id)
 {
     #if UNITY_IPHONE && !UNITY_EDITOR
     HeyzapAdsIOS.AddFacebookTestDevice(device_id);
     #endif
 }