Пример #1
0
 // Reports an app download to MoPub. iTunesAppId is iOS only.
 public static void reportApplicationOpen(string iTunesAppId = null)
 {
             #if UNITY_IPHONE
     MoPubBinding.reportApplicationOpen(iTunesAppId);
             #elif UNITY_ANDROID
     MoPubAndroid.reportApplicationOpen();
             #endif
 }
Пример #2
0
    private void PlayHavenOrMopubAdOnMainMenu()
    {
        if (gameLaunch)
        {
            UserPrefs.Load();
                        #if UNITY_ANDROID
            if (!UserPrefs.isIgnoreAds)
            {
                MoPubAndroid.reportApplicationOpen();
                //				MoPubAndroid.initAppLovinSDK();
                //				MoPubAndroid.initHeyzapSDK(Constants.PUBLISHER_ID);
                //				MoPubAndroid.initPlayhavenSession();
            }
                        #endif
            if (!UserPrefs.isIgnoreAds)
            {
                Debug.Log("++++ AdsManagerStart +++++");
                                #if UNITY_ANDROID
                Upsight.init(Constants.AndroidAppTokenPlayHaven, Constants.AndroidAppSecretPlayHaven);
                                #else
                Upsight.init(Constants.iOSAppTokenPlayHaven, Constants.iOSAppSecretPlayHaven);
                                #endif

                // Make an open request at every app launch
                Upsight.requestAppOpen();


                UpsightManager.makePurchaseEvent   += myMakePurchaseMethod;
                UpsightManager.unlockedRewardEvent += myUnlockedRewardMethod;

                Upsight.sendContentRequest("game_launch", true);



                //				CreateBannerAds();
                this.hideBannerAds();
            }



            gameLaunch = false;
        }
        //		else
        //		{
        //			if(!UserPrefs.isIgnoreAds)
        //			{
        //				#if UNITY_ANDROID
        //				if (MoPubAndroidManager.INTERSTITIAL_AD_STATE != MoPubAndroidManager.INTERSTITIAL_STATES.LOADED
        //				    && MoPubAndroidManager.INTERSTITIAL_AD_STATE != MoPubAndroidManager.INTERSTITIAL_STATES.LOADING){
        //
        //					if(GameManager.Instance.GetPreviousGameState() != GameManager.GameState.LEVELSETTINGS){
        //						MoPubAndroid.requestInterstitalAd(Constants.INTERSTITIAL_ID_ANDROID);
        //						MoPubAndroidManager.INTERSTITIAL_AD_STATE = MoPubAndroidManager.INTERSTITIAL_STATES.LOADING;
        //						Debug.Log(" ++++ MoPub Ads Start Loading ++++");
        //					}
        //
        //
        //				}
        //				Debug.Log(" ++++ MoPub Ads State :"+MoPubAndroidManager.INTERSTITIAL_AD_STATE+" ++++");
        //
        //				#endif
        //				#if UNITY_IPHONE
        //				MoPubBinding.requestInterstitialAd(Constants.INTERSTITIAL_ID_IOS,null);
        //				//				StartCoroutine(WaitForMopubAddOnMainMenu());
        //				//				if(MoPubManager.INTERSTITIAL_AD_STATE == MoPubManager.INTERSTITIAL_STATES.LOADED)
        //				//					MoPubBinding.showInterstitialAd(Constants.INTERSTITIAL_ID);
        //				#endif
        //				ShowMopubAdOnMainMenu();
        //			}
        //		}
    }