void onAppLovinEventReceived(string ev) { if (ev.Contains("DISPLAYEDINTER")) { // An ad was shown. Pause the game. } else if (ev.Contains("HIDDENINTER")) { // Ad ad was closed. Resume the game. // If you're using PreloadInterstitial/HasPreloadedInterstitial, make a preload call here. AppLovin.PreloadInterstitial(); } else if (ev.Contains("LOADEDINTER")) { // An interstitial ad was successfully loaded. } else if (string.Equals(ev, "LOADINTERFAILED")) { // An interstitial ad failed to load. } else if (ev.Contains("LOADEDREWARDED")) { // A rewarded video was successfully loaded. } else if (ev.Contains("LOADREWARDEDFAILED")) { // A rewarded video failed to load. } else if (ev.Contains("HIDDENREWARDED")) { // A rewarded video was closed. Preload the next rewarded video. AppLovin.LoadRewardedInterstitial(); } }
public bool PreLoadAd() { if (m_RewardVideoHandler == null) { return(false); } if (!m_HasInit) { m_HasInit = true; ApplovinEventCenter.S.on_RewardLoaded += HandleOnAdLoaded; ApplovinEventCenter.S.on_RewardClose += HandleOnAdClosed; ApplovinEventCenter.S.on_RewardLoadFailed += HandleOnAdFailedToLoad; ApplovinEventCenter.S.on_RewardReward += HandleOnAdRewarded; } if (isAdReady) { return(false); } AppLovin.LoadRewardedInterstitial(m_RewardVideoHandler.GetAdConfig().unitID); return(true); }
void Awake() { if (LaunchManager.IsFirstLaunchForCurrentSession) { AdsRemoved = PlayerPrefs.GetInt("RemoveAds", 0) == 1; DontDestroyOnLoad(gameObject); instance = this; #if UNITY_ANDROID AppLovin.SetSdkKey(SDK_KEY); AppLovin.InitializeSdk(); AppLovin.SetUnityAdListener(gameObject.name); if (!AdsRemoved) { AppLovin.PreloadInterstitial(); ShowBanner(); } AppLovin.LoadRewardedInterstitial(); #elif UNITY_IOS if (!LaunchManager.IsFirstSession) { Init(); } #endif } else { #if UNITY_IOS if (!SkyRiseAds.instance.IsInit) { SkyRiseAds.instance.Init(); } #endif Destroy(gameObject); } }
/// <summary> /// preload a rewarded video ad before showing /// if it fails for maxRetryCount times do not try anymore /// </summary> void PreloadRewardedVideo() { retryNumberRewarded++; if (retryNumberRewarded < maxRetryCount) { AppLovin.LoadRewardedInterstitial(); } }
private void LoadVideoDelay() { AppLovin.LoadRewardedInterstitial(); if (GameSettings.settings.boughtRemoveAds) { AppLovin.HideAd(); } }
void onAppLovinEventReceived(string ev) { Debug.Log("ENTERED APPLOVIN CALLABACK REGION."); Debug.Log("EVENT: " + ev); if (ev.Contains("DISPLAYEDINTER")) { // An ad was shown. Pause the game. } else if (ev.Contains("HIDDENINTER")) { // Ad ad was closed. Resume the game. // If you're using PreloadInterstitial/HasPreloadedInterstitial, make a preload call here. AppLovin.PreloadInterstitial(); AdsHandler.currentAdState = Result.Closed; OnInterstitialAdClosed(); } else if (ev.Contains("LOADEDINTER")) { // An interstitial ad was successfully loaded. } else if (string.Equals(ev, "LOADINTERFAILED")) { // An interstitial ad failed to load. } if (ev.Contains("REWARDAPPROVEDINFO")) { // The format would be "REWARDAPPROVEDINFO|AMOUNT|CURRENCY" so "REWARDAPPROVEDINFO|10|Coins" for example string delimeter = "|"; // Split the string based on the delimeter string[] split = ev.Split(delimeter.ToCharArray()); // Pull out the currency amount double amount = double.Parse(split[1]); // Pull out the currency name string currencyName = split[2]; // Do something with the values from above. For example, grant the coins to the user. } else if (ev.Contains("LOADEDREWARDED")) { // A rewarded video was successfully loaded. } else if (ev.Contains("LOADREWARDEDFAILED")) { // A rewarded video failed to load. } else if (ev.Contains("HIDDENREWARDED")) { // A rewarded video was closed. Preload the next rewarded video. AppLovin.LoadRewardedInterstitial(); AdsHandler.currentAdState = Result.Closed; OnRewardedAdClosed(); } }
public void ContinuePlaying() { if (AppLovin.IsIncentInterstitialReady()) { AppLovin.ShowRewardedInterstitial(); } else { AppLovin.LoadRewardedInterstitial(); } }
void Start() { m_rewardDelegate = EmptyMothod; #if !UNITY_EDITOR AppLovin.SetSdkKey("cBmxxgR0WEQ2g9uRR0mbcORZUeFHePvFbfAXKcTsrzvW7nzZniAN6cyaFCsucm8DPJllwHbmFUHNFFx0y5O2hL"); AppLovin.InitializeSdk(); AppLovin.LoadRewardedInterstitial(); AppLovin.SetUnityAdListener(gameObject.name); #endif }
// Use this for initialization private void Awake() { instance = this; Application.targetFrameRate = 60; isGameOver = false; AppLovin.SetSdkKey("Mw_ES5QLA1N9SQwMF5ZANA5GH26ffm80f8E7DfSNgqX8ERUUX3evEkAVnGAQ0JRgRfofKE203Z8I0cnTgPSv8c"); AppLovin.InitializeSdk(); AppLovin.SetUnityAdListener("_GameManager"); AppLovin.PreloadInterstitial(); AppLovin.LoadRewardedInterstitial(); }
void onAppLovinEventReceived(string ev) { if (ev.Contains("HIDDENREWARDED")) { PlayerPrefs.SetInt("Coins", PlayerPrefs.GetInt("Coins") + 5); PlayerPrefs.SetFloat("CoinsTimer", 3600); startTimer = true; AppLovin.LoadRewardedInterstitial(); } if (ev.Contains("USERCLOSEDEARLY")) { PlayerPrefs.SetInt("Coins", PlayerPrefs.GetInt("Coins") - 5); } }
protected override void InternalInit() { #if EM_APPLOVIN mAdSettings = EM_Settings.Advertising.AppLovin; mCustomRewardedVideoAds = new List <AdPlacement>(); mCustomInterstitialAds = new List <AdPlacement>(); mCustomBanners = new Dictionary <AdPlacement, KeyValuePair <BannerAdPosition, BannerAdSize> >(); // Set GDPR consent if any. var consent = GetApplicableDataPrivacyConsent(); ApplyDataPrivacyConsent(consent); AppLovin.SetSdkKey(mAdSettings.SDKKey); AppLovin.InitializeSdk(); // Test Mode if (mAdSettings.EnableTestMode) { AppLovin.SetTestAdsEnabled("true"); } else { AppLovin.SetTestAdsEnabled("false"); } // Age-Restricted if (mAdSettings.AgeRestrictMode) { AppLovin.SetIsAgeRestrictedUser("true"); } else { AppLovin.SetIsAgeRestrictedUser("false"); } AppLovin.LoadRewardedInterstitial(); // Setup Events Listener GameObject listener = new GameObject(); listener.name = "EM_AppLovinAdsListenerObject"; UnityEngine.Object.Instantiate(listener, Vector3.zero, Quaternion.identity); listener.AddComponent <EM_AppLovinAdsListener>(); listener.GetComponent <EM_AppLovinAdsListener>().setAdClient(this); AppLovin.SetUnityAdListener("EM_AppLovinAdsListenerObject"); // Done Initialization. mIsInitialized = true; Debug.Log("AppLovin client has been initialized."); #endif }
/// <summary> /// Initialize Applovin SDK. /// </summary> /// <param name="preLoadAds">Enable pre-load ads.</param> public void InitializeApplovin(bool preLoadAds = true, string listenergo = null) { AppLovin.SetSdkKey("kVL0LZFNc8EVPKb9s4tuJRZOu0UHxTphLiVnq4BoOahg-2NEK5Urh5f3gu7G9ttx9FkLeHvD7v08TMOrF-w1Hv"); AppLovin.InitializeSdk(); AppLovin.SetTestAdsEnabled("true"); AppLovin.SetUnityAdListener(listenergo); if (preLoadAds) { AppLovin.LoadRewardedInterstitial(); AppLovin.PreloadInterstitial(); } Debug.Log("<color=blue> AppLovin Initialized.</color>"); }
public bool ShowRewardedInterstitial() // show video { if (!AppLovin.IsIncentInterstitialReady()) { _isPreloadingRewardedVideo = true; AppLovin.LoadRewardedInterstitial(); } else { _isPreloadingRewardedVideo = false; AppLovin.ShowRewardedInterstitial(); AppsFlyerManager.Instance.TrackVideoAppLovinView(); return(true); } return(false); }
public void Init() { if (!IsInit) { AppLovin.SetSdkKey(SDK_KEY); AppLovin.InitializeSdk(); AppLovin.SetUnityAdListener(gameObject.name); IsInit = true; Debug.Log("ads are removed: " + AdsRemoved); if (!AdsRemoved) { AppLovin.PreloadInterstitial(); ShowBanner(); } AppLovin.LoadRewardedInterstitial(); } }
void onAppLovinEventReceived(string ev) { if (ev.Contains("REWARDAPPROVEDINFO")) { } else if (ev.Contains("LOADEDREWARDED")) { StartCoroutine(CountDown()); } else if (ev.Contains("LOADREWARDEDFAILED")) { // A rewarded video failed to load. } else if (ev.Contains("HIDDENREWARDED")) { // A rewarded video has been closed. Preload the next rewarded video. AppLovin.LoadRewardedInterstitial(); } }
private void onAppLovinEventReceived(string value) { Debug.Log(value); switch (value) { #if UNITY_IOS case "HIDDENREWARDED": Music.instance.UnPause(); OnRewardedInterClosed(); AppLovin.LoadRewardedInterstitial(); break; #elif UNITY_ANDROID case "REWARDAPPROVED": OnRewardedInterClosed(); AppLovin.LoadRewardedInterstitial(); break; #endif case "HIDDENINTER": #if UNITY_IOS Music.instance.UnPause(); #endif if (OnInterClosed != null) { OnInterClosed(); } AppLovin.PreloadInterstitial(); break; case "REWARDREJECTED": case "REWARDOVERQUOTA": case "REWARDTIMEOUT": OnRewardedInterFailed(); break; #if UNITY_IOS case "DISPLAYEDREWARDED": case "DISPLAYEDINTER": Music.instance.Pause(); break; #endif } }
public void PreloadOrShowRewardedInterstitial() { if (AppLovin.IsIncentInterstitialReady()) { Log("Showing rewarded ad..."); IsPreloadingRewardedVideo = false; RewardedVideoButtonTitle.text = REWARDED_VIDEO_BUTTON_TITLE_PRELOAD; AppLovin.ShowRewardedInterstitial(); } else { Log("Preloading rewarded ad..."); IsPreloadingRewardedVideo = true; RewardedVideoButtonTitle.text = REWARDED_VIDEO_BUTTON_TITLE_LOADING; AppLovin.LoadRewardedInterstitial(); } }
protected override void InternalLoadRewardedAd(AdPlacement placement) { #if EM_APPLOVIN string id = placement == AdPlacement.Default ? mAdSettings.DefaultRewardedAdId.Id : FindIdForPlacement(mAdSettings.CustomRewardedAdIds, placement); if (placement.Equals(AdPlacement.Default)) // Default interstitial ad... { if (string.IsNullOrEmpty(id)) { AppLovin.LoadRewardedInterstitial(); } else { AppLovin.LoadRewardedInterstitial(id); } } else // Custom interstitial ad... { // Add a placement if needed if (!mCustomRewardedVideoAds.Contains(placement)) { mCustomRewardedVideoAds.Add(placement); } if (string.IsNullOrEmpty(id)) { AppLovin.LoadRewardedInterstitial(); } else { AppLovin.LoadRewardedInterstitial(id); } } #endif }
void onAppLovinEventReceived(string ev) { if (ev.Contains("HIDDENREWARDED")) { AppLovin.LoadRewardedInterstitial(); OnVideoSuccess(); } else if (ev.Contains("VIDEOBEGAN")) { //OnVideoStart(); } else if (ev.Contains("REWARDAPPROVED")) { //OnVideoSuccess(); } else if (ev.Contains("REWARDREJECTED")) { //OnVideoFailure(); } else if (ev.Contains("VIDEOSTOPPED")) { //OnVideoClose(); } }
/****************************************奖励视频******************************************** */ //下载 奖励视频 private void LoadRewarded() { AppLovin.LoadRewardedInterstitial(rewarded_zoneID);//预加载奖励视频 }
void Start() { #if UNITY_ANDROID #elif UNITY_IPHONE AppLovin.SetSdkKey("blT3W15rTlQhPKkcarKUZZ46toGIC1vDT62aVhQucHACCSDo7xaRPFVtAHpG5sE6SsB2pu8xHmxy6OFnFvth2s"); #endif AppLovin.InitializeSdk(); AppLovin.SetUnityAdListener("AppLovinListener"); AppLovin.ShowAd(AppLovin.AD_POSITION_CENTER, AppLovin.AD_POSITION_BOTTOM); AppLovin.LoadRewardedInterstitial(); if (PlayerPrefs.HasKey("BallAvailability") && PlayerPrefs.HasKey("NetAvailability") && PlayerPrefs.HasKey("FloorAvailability")) { } else { PlayerPrefs.SetInt("BallAvailability", 1); PlayerPrefs.SetInt("NetAvailability", 1); PlayerPrefs.SetInt("FloorAvailability", 1); } ballSkins = new Sprite[5]; ballSkins[0] = basketBall; ballSkins[1] = tennisBall; ballSkins[2] = soccerBall; ballSkins[3] = bowlingBall; ballSkins[4] = volleyBall; ball.sprite = ballSkins[PlayerPrefs.GetInt("CurrentBall")]; netSkins = new Sprite[5]; netSkins[0] = netOne; netSkins[1] = netTwo; netSkins[2] = netThree; netSkins[3] = netFour; netSkins[4] = netFive; net.sprite = netSkins[PlayerPrefs.GetInt("CurrentNet")]; floorSkins = new Sprite[5]; floorSkins[0] = floorOne; floorSkins[1] = floorTwo; floorSkins[2] = floorThree; floorSkins[3] = floorFour; floorSkins[4] = floorFive; floor.sprite = floorSkins[PlayerPrefs.GetInt("CurrentFloor")]; Time.timeScale = 1; Button playBtn = play.GetComponent <Button>(); playBtn.onClick.AddListener(PlayButtonClick); Button leaderboardBtn = leaderboard.GetComponent <Button>(); leaderboardBtn.onClick.AddListener(LeaderboardButtonClick); Button rateBtn = rate.GetComponent <Button>(); rateBtn.onClick.AddListener(RateButtonClick); Button classicBtn = classic.GetComponent <Button>(); classic.onClick.AddListener(ClassicButtonClick); Button timeBtn = time.GetComponent <Button>(); time.onClick.AddListener(TimeButtonClick); Button hardBtn = hard.GetComponent <Button>(); hard.onClick.AddListener(HardButtonClick); Button backBtn = back.GetComponent <Button>(); back.onClick.AddListener(BackButtonClick); Button customizeBtn = customize.GetComponent <Button>(); customize.onClick.AddListener(CustomizeButtonClick); #if UNITY_ANDROID leaderboardBtn.gameObject.SetActive(false); #elif UNITY_IPHONE Social.localUser.Authenticate(ProcessAuthentication); #endif }
public void LoadVideo() { AppLovin.LoadRewardedInterstitial(); }