You can find here custom methods and events that can be use to fine-tune the use of our SDK. Any question? Shoot us an email support@palmup.io
To further customize the behavior of your ad, you can hook into a number of events in the ad's lifecycle: loading, opening, closing, and so on. Listen for these events by registering a delegate for the appropriate EventHandler, as shown below.
AdEvent | Description |
OnConnectFailed | Called when the Palmup SDK failed to connect. |
OnConnectSuccess | Called when the Palmup SDK successfully connected. |
OnAdLoaded | Called when an ad request has successfully loaded. |
OnAdClosed | Called when the ad is closed. |
OnAdComplete | Called at the end of the video completion |
OnAdOpening | Called when an ad is shown. |
OnAdFailedToLoad | Called when an ad request failed to load. |
OnAdLeavingApplication | Called when the ad click caused the user to leave the application. |
OnAdDemandSuccess | Called when Palmup Sever got an ad available (mediation purpose) |
OnAdDemandSuccessAdUnit<string adUnit> | Called when Palmup Sever got an ad available an giving you the targeted adUnit (Waterfall purpose) |
OnNoAdToShow | Called when Palmup Sever don't have any ad available (mediation purpose). |
OnAdDemandFailed | Called when the call to the Palmup server failed. |
OnConsentPopUpAgree | Called when the consent pop up Agree button is clicked |
OnConsentPopUpDisagree | Called when the consent pop up Disagree button is clicked |
using System.Collections;using System.Collections.Generic;using UnityEngine;using Palmup;public class MainScript : MonoBehaviour{void start(){initializePalmupEvents()}void initializePalmupEvents()// Called when the Palmup SDK failed to connect.Palmup.PalmupLauncher.OnConnectFailed += HandleOnConnectFailed;// Called when the Palmup SDK successfully connected.Palmup.PalmupLauncher.OnConnectSuccess += HandleOnConnectSuccess;// Called when an ad request has successfully loaded.Palmup.PalmupLauncher.OnAdLoaded += HandleOnAdLoaded;// Called when the ad is closed.Palmup.PalmupLauncher.OnAdClosed += HandleOnAdClosed;// Called when the ad video complete.Palmup.PalmupLauncher.OnAdComplete += HandleOnAdComplete;// Called when an ad is shown.Palmup.PalmupLauncher.OnAdOpening += HandleOnAdOpening;// Called when an ad request failed to load.Palmup.PalmupLauncher.OnAdFailedToLoad += HandleOnAdFailedToLoad;// Called when the ad click caused the user to leave the application.Palmup.PalmupLauncher.OnAdLeavingApplication += HandleOnAdLeavingApplication;// Called when Palmup Sever respond successfully to an ad demand (mediation purpose).Palmup.PalmupLauncher.OnAdDemandSuccess += HandleOnAdDemandSuccess;// Called when Palmup Sever respond successfully to an ad demand (Waterfall purpose)Palmup.PalmupLauncher.OnAdDemandSuccessAdUnit += HandleOnAdDemandSuccessAdUnit;// Called when Palmup Sever don't have any ad available (mediation purpose).Palmup.PalmupLauncher.OnNoAdToShow += HandleOnNoAdToShow;// Called when the call to the Palmup server failed.Palmup.PalmupLauncher.OnAdDemandFailed += HandleOnAdDemandFailed;// Called when the consent pop up Agree button is clickedPalmup.PalmupLauncher.OnConsentPopUpAgree += HandleOnConsentPopUpAgree;// Called when the consent pop up Disagree button is clickedPalmup.PalmupLauncher.OnConsentPopUpDisagree += HandleOnConsentPopUpDisagree;}public void HandleOnAdDemandSuccess(){Debug.Log("HandleOnAdDemandSuccess");}public void HandleOnAdDemandSuccessAdUnit(string adUnit){Debug.Log("HandleOnAdDemandSuccess for specific ad unit : " + adUnit);}public void HandleOnAdDemandFailed(){Debug.Log("HandleOnAdDemandFailed");}public void HandleOnNoAdToShow(){Debug.Log("HandleOnNoAdToShow");}public void HandleOnConnectFailed(){Debug.Log("HandleOnConnectFailed");}public void HandleOnConnectSuccess(){Debug.Log("HandleOnConnectSuccess");}public void HandleOnAdLoaded(){Debug.Log("HandleOnAdLoaded");}public void HandleOnAdClosed(){Debug.Log("HandleOnAdClosed");}public void OnAdComplete(){Debug.Log("OnAdComplete");}public void HandleOnAdOpening(){Debug.Log("HandleOnAdOpening");}public void HandleOnAdFailedToLoad(){Debug.Log("HandleOnAdFailedToLoad");}public void HandleOnAdLeavingApplication(){Debug.Log("HandleOnAdLeavingApplication");}public void HandleOnConsentPopUpAgree(){Debug.Log("HandleOnConsentPopUpAgree");}public void HandleOnConsentPopUpDisagree(){Debug.Log("HandleOnConsentPopUpDisagree");}}
Be sure of importing Palmup to access events using Palmup;
You can force displayed ads to disappear using this method.
Palmup.launcher.killAllAds();
This can be useful in certain situations where you do not want an ad to remain displayed.
For example, you launchAd()
at Game Over and your don't want any ad to remain on screen when the game start again. Just call the killAllAds()
method when the player press on the Start button.
Using killAllAds()
might negatively affect your revenues as the video completion could be lower.