Пример #1
0
 public static void showAdMobBanner()
 {
     if (SSAdInitializer.AdMobActiveStaticFlag)
     {
         AdMobBinding.createBanner(AdMobBannerType.SmartBannerPortrait, AdMobAdPosition.BottomCenter);
     }
 }
Пример #2
0
    // HELPERS

    public bool admobShowBannerAd()
    {
        #if AD_USE_ADMOB
        if (Application.platform == RuntimePlatform.Android)
        {
        #if UNITY_ANDROID
            //AdMob.createBanner(
            //admobGetBannerType(bannerType),
            //admobGetPosition(placementType)
            //);
        #endif
        }
        else if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
        #if UNITY_IPHONE
            AdMobBinding.createBanner(
                admobGetBannerType(bannerType),
                admobGetPosition(position)
                );
        #endif
        }
        else
        {
            // Web player...
        #if UNITY_WEBPLAYER
            //Application.ExternalCall("if(window.console) window.console.log","web show twitter login");
        #endif
        }
        #endif

        return(false);
    }
Пример #3
0
    public bool admobHideBannerAd()
    {
        #if AD_USE_ADMOB
        if (Application.platform == RuntimePlatform.Android)
        {
        #if UNITY_ANDROID
            AdMob.destroyBanner();
            return(true);
        #endif
        }
        else if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
        #if UNITY_IPHONE
            AdMobBinding.destroyBanner();
            return(true);
        #endif
        }
        else
        {
            // Web player...
        #if UNITY_WEBPLAYER
            //Application.ExternalCall("if(window.console) window.console.log","web show twitter login");
        #endif
        }
        #endif

        return(false);
    }
Пример #4
0
 // Use this for initialization
 void Start()
 {
             #if UNITY_ANDROID
     AdMobAndroid.init("a15312a8eb50af0");
     AdMobAndroid.createBanner(AdMobAndroidAd.phone320x50, AdMobAdPlacement.BottomCenter);
             #elif UNITY_IPHONE
     AdMobBinding.init("a15312abc21db24");
     AdMobBinding.createBanner(AdMobBannerType.iPad_468x60, AdMobAdPosition.BottomCenter);
             #endif
 }
Пример #5
0
    // Starts loading an interstitial ad

    public void RequestInterstital()
    {
        if (InterstialUnitId.Length != 0)
        {
            AdMobBinding.requestInterstital(InterstialUnitId);
        }
        else
        {
            Debug.Log("iOsAdMobController::RequestInterstital - InterstialUnitId is empty");
        }
    }
Пример #6
0
    void OnGUI()
    {
        beginColumn();


        if (GUILayout.Button("Initialize AdMob"))
        {
            AdMobBinding.setTestDevices(new string[] { "079adeed23ef3e9a9ddf0f10c92b8e18" });               // iPad mini
            AdMobBinding.init("YOUR_PUBLISHER_ID", true);
        }


        if (GUILayout.Button("Destroy Banner"))
        {
            AdMobBinding.destroyBanner();
        }


        if (GUILayout.Button("Portrait Smart Banner (top right)"))
        {
            AdMobBinding.createBanner(AdMobBannerType.SmartBannerPortrait, AdMobAdPosition.TopRight);
        }


        if (GUILayout.Button("Landscape Smart Banner (bottom)"))
        {
            AdMobBinding.createBanner(AdMobBannerType.SmartBannerLandscape, AdMobAdPosition.BottomCenter);
        }


        if (UnityEngine.iOS.Device.generation != UnityEngine.iOS.DeviceGeneration.iPad1Gen && UnityEngine.iOS.Device.generation != UnityEngine.iOS.DeviceGeneration.iPad2Gen && UnityEngine.iOS.Device.generation != UnityEngine.iOS.DeviceGeneration.iPad3Gen)
        {
            if (GUILayout.Button("320x50 Banner (bottom right)"))
            {
                AdMobBinding.createBanner(AdMobBannerType.iPhone_320x50, AdMobAdPosition.BottomRight);
            }
        }
        else
        {
            if (GUILayout.Button("320x250 Banner (bottom)"))
            {
                AdMobBinding.createBanner(AdMobBannerType.iPad_320x250, AdMobAdPosition.BottomCenter);
            }


            if (GUILayout.Button("468x60 Banner (top)"))
            {
                AdMobBinding.createBanner(AdMobBannerType.iPad_468x60, AdMobAdPosition.TopCenter);
            }


            if (GUILayout.Button("728x90 Banner (bottom)"))
            {
                AdMobBinding.createBanner(AdMobBannerType.iPad_728x90, AdMobAdPosition.BottomCenter);
            }
        }


        endColumn(true);


        if (GUILayout.Button("Request Interstitial"))
        {
            AdMobBinding.requestInterstital("a14d3e67dfeb7ba");
            //AdMobBinding.requestInterstitalAd( "YOUR_INTERSTITIAL_UNIT_ID" );
        }


        if (GUILayout.Button("Is Interstial Loaded?"))
        {
            Debug.Log("is interstitial loaded: " + AdMobBinding.isInterstitialAdReady());
        }


        if (GUILayout.Button("Show Interstitial"))
        {
            AdMobBinding.displayInterstital();
        }

        endColumn();
    }
Пример #7
0
 // If an interstitial ad is loaded this will take over the screen and show the ad
 public void DisplayInterstital()
 {
     AdMobBinding.displayInterstital();
 }
Пример #8
0
 // Checks to see if the interstitial ad is loaded and ready to show
 public bool IsInterstitialAdReady()
 {
     return(AdMobBinding.isInterstitialAdReady());
 }
Пример #9
0
    void OnGUI()
    {
        beginColumn();


        if (GUILayout.Button("Initialize AdMob"))
        {
            // add your test devices
            AdMobBinding.setTestDevices(new string[] { "<DEVICE_ID>", "DEVICE_ID" });
            AdMobBinding.init("YOUR_PUBLISHER_ID", true);
        }


        if (GUILayout.Button("Destroy Banner"))
        {
            AdMobBinding.destroyBanner();
        }


        if (GUILayout.Button("Portrait Smart Banner (top right)"))
        {
            AdMobBinding.createBanner(AdMobBannerType.SmartBannerPortrait, AdMobAdPosition.TopRight);
        }


        if (GUILayout.Button("Landscape Smart Banner (bottom)"))
        {
            AdMobBinding.createBanner(AdMobBannerType.SmartBannerLandscape, AdMobAdPosition.BottomCenter);
        }


        if (iPhone.generation != iPhoneGeneration.iPad1Gen && iPhone.generation != iPhoneGeneration.iPad2Gen &&
            iPhone.generation != iPhoneGeneration.iPad3Gen && iPhone.generation != iPhoneGeneration.iPad4Gen && iPhone.generation != iPhoneGeneration.iPadMini1Gen)
        {
            if (GUILayout.Button("320x50 Banner (bottom right)"))
            {
                // replace the adUnitId with your own!
                AdMobBinding.createBanner("BANNER_ID", AdMobBannerType.iPhone_320x50, AdMobAdPosition.BottomRight);
            }
        }
        else
        {
            if (GUILayout.Button("320x250 Banner (bottom)"))
            {
                // replace the adUnitId with your own!
                AdMobBinding.createBanner("BANNER_ID", AdMobBannerType.iPad_320x250, AdMobAdPosition.BottomCenter);
            }


            if (GUILayout.Button("468x60 Banner (top)"))
            {
                AdMobBinding.createBanner(AdMobBannerType.iPad_468x60, AdMobAdPosition.TopCenter);
            }


            if (GUILayout.Button("728x90 Banner (bottom)"))
            {
                AdMobBinding.createBanner(AdMobBannerType.iPad_728x90, AdMobAdPosition.BottomCenter);
            }
        }


        endColumn(true);


        if (GUILayout.Button("Request Interstitial"))
        {
            // replace the adUnitId with your own!
            AdMobBinding.requestInterstital("INTERSTITIAL_ID");
        }


        if (GUILayout.Button("Is Interstial Loaded?"))
        {
            Debug.Log("is interstitial loaded: " + AdMobBinding.isInterstitialAdReady());
        }


        if (GUILayout.Button("Show Interstitial"))
        {
            AdMobBinding.displayInterstital();
        }

        endColumn();
    }
Пример #10
0
 // Destroys the banner and removes it from view
 public void DestroyBanner()
 {
     AdMobBinding.destroyBanner();
 }
Пример #11
0
 // Creates a banner of the given type at the given position
 public void createBanner(AdMobBannerType bannerType, AdMobAdPosition position)
 {
     AdMobBinding.createBanner(bannerType, position);
 }
Пример #12
0
 // Adds a test device
 public void SetTestDevices(string[] deviceIds)
 {
     AdMobBinding.setTestDevices(deviceIds);
 }
Пример #13
0
 // Sets the publiser Id and prepares AdMob for action.  Must be called before any other methods!
 public void Initialize(string newPublisherId, bool isTesting)
 {
     PublisherId = newPublisherId;
     AdMobBinding.init(PublisherId, isTesting);
 }
Пример #14
0
 // Sets the publiser Id and prepares AdMob for action.  Must be called before any other methods!
 public void Initialize(string newPublisherId)
 {
     PublisherId = newPublisherId;
     AdMobBinding.init(PublisherId);
 }
Пример #15
0
 public void RequestInterstital(string interstitialUnitId)
 {
     AdMobBinding.requestInterstital(interstitialUnitId);
 }
Пример #16
0
    void OnGUI()
    {
        beginColumn();


        if (GUILayout.Button("Initialize AdMob"))
        {
            // replace with your test devices and publisher ID!
            AdMobBinding.setTestDevices(new string[] { "079adeed23ef3e9a9ddf0f10c92b8e18", "2370bc487b3a1efb28baed63a6acbf20" });
            AdMobBinding.init("a150630f69e2282", true);
        }


        if (GUILayout.Button("Destroy Banner"))
        {
            AdMobBinding.destroyBanner();
        }


        if (GUILayout.Button("Portrait Smart Banner (top right)"))
        {
            AdMobBinding.createBanner(AdMobBannerType.SmartBannerPortrait, AdMobAdPosition.TopRight);
        }


        if (GUILayout.Button("Landscape Smart Banner (bottom)"))
        {
            AdMobBinding.createBanner(AdMobBannerType.SmartBannerLandscape, AdMobAdPosition.BottomCenter);
        }


        if (iPhone.generation != iPhoneGeneration.iPad1Gen && iPhone.generation != iPhoneGeneration.iPad2Gen &&
            iPhone.generation != iPhoneGeneration.iPad3Gen && iPhone.generation != iPhoneGeneration.iPad4Gen && iPhone.generation != iPhoneGeneration.iPadMini1Gen)
        {
            if (GUILayout.Button("320x50 Banner (bottom right)"))
            {
                // replace the adUnitId with your own!
                AdMobBinding.createBanner("ca-app-pub-8386987260001674/2631573141", AdMobBannerType.iPhone_320x50, AdMobAdPosition.BottomRight);
            }
        }
        else
        {
            if (GUILayout.Button("320x250 Banner (bottom)"))
            {
                // replace the adUnitId with your own!
                AdMobBinding.createBanner("ca-app-pub-8386987260001674/2631573141", AdMobBannerType.iPad_320x250, AdMobAdPosition.BottomCenter);
            }


            if (GUILayout.Button("468x60 Banner (top)"))
            {
                AdMobBinding.createBanner(AdMobBannerType.iPad_468x60, AdMobAdPosition.TopCenter);
            }


            if (GUILayout.Button("728x90 Banner (bottom)"))
            {
                AdMobBinding.createBanner(AdMobBannerType.iPad_728x90, AdMobAdPosition.BottomCenter);
            }
        }


        endColumn(true);


        if (GUILayout.Button("Request Interstitial"))
        {
            // replace the adUnitId with your own!
            AdMobBinding.requestInterstital("ca-app-pub-8386987260001674/7061772743");
        }


        if (GUILayout.Button("Is Interstial Loaded?"))
        {
            Debug.Log("is interstitial loaded: " + AdMobBinding.isInterstitialAdReady());
        }


        if (GUILayout.Button("Show Interstitial"))
        {
            AdMobBinding.displayInterstital();
        }

        endColumn();
    }
    // Use this for initialization
    void Awake()
    {
        //Set Static flags
        ChartBoostActiveStaticFlag = ChartBoostActiveFlag;
        RevMobActiveStaticFlag     = RevMobActiveFlag;
        AdMobActiveStaticFlag      = AdMobActiveFlag;
        PlayHavenActiveStaticFlag  = PlayHavenActiveFlag;
        IAdsActiveStaticFlag       = IAdsActiveFlag;
        TapJoyActiveStaticFlag     = TapJoyActiveFlag;
        VungleActiveStaticFlag     = VungleActiveFlag;
        FlurryActiveStaticFlag     = FlurryActiveFlag;
        AppLovinStaticFlag         = AppLovinFlag;

        //Initialize ChartBoost
        if (ChartBoostActiveFlag)
        {
            ChartBoostBinding.init(ChartBoostID, ChartBoostSIG, false);
            ChartBoostBinding.cacheInterstitial(null);
            ChartBoostBinding.cacheMoreApps();
        }

        //Initialize RevMob
        if (RevMobActiveFlag)
        {
            REVMOB_APP_IDS.Add("IOS", RevMobID);
            revMobSession = RevMob.Start(REVMOB_APP_IDS);
        }

        //Initialize Admob
        if (AdMobActiveFlag)
        {
            AdMobBinding.init(AdMobID);
        }

        //Initialize Playhaven
        if (PlayHavenActiveFlag)
        {
            gameObject.SendMessage("OpenNotification");
        }

        //Initialize iAds
        if (IAdsActiveFlag)
        {
        }

        //Initialize TapJoy
        if (TapJoyActiveFlag)
        {
            TapjoyPluginIOS.RequestTapjoyConnect(TapJoyID, TapJoySecretKey);
            Debug.Log("Tapjoy integrated");
        }

        //Initialize Vungle
        if (VungleActiveFlag)
        {
            VungleBinding.startWithAppId(VungleID);
        }

        //Initialize Flurry
        if (FlurryActiveFlag)
        {
            FlurryBinding.startSession(FlurryID);
            //FlurryBinding.logEvent("Testing session started", false);
        }

        if (AppLovinFlag)
        {
            AppLovin.SetSdkKey(AppLovinID);
            AppLovin.InitializeSdk();
        }
    }