Exemplo n.º 1
0
    /**
     * Initialization, set the AdmobId (Site publisher ID or mediation ID).
     *
     * This function is for the legacy Admob front-end, which uses only a
     * single Ad publisher ID.
     *
     * @param admobId
     *            string - Your Admob Publisher ID
     */
    public void Init(string admobId)
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().Init(admobId, admobId, false);
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().Init(admobId, admobId, false);
#endif
    }
Exemplo n.º 2
0
    /**
     * Constructor.
     */
    private AdmobAd()
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().SetNativeHelper(new AdmobAdNativeHelper());
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance();
#endif
    }
Exemplo n.º 3
0
    /**
     * Destroy the Banner Ad.
     */
    public void DestroyBannerAd()
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().DestroyBannerAd();
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().DestroyBannerAd();
#endif
    }
Exemplo n.º 4
0
    /**
     * Initialization, set the Ad Unit IDs.
     *
     * This function is for the new Admob frond-end.
     * NOTE: the Ad Unit ID is in the following form:
     * ca-app-pub-XXXXXXXXXXXXXXXX/NNNNNNNNNN
     *
     * @param bannerAdUnitId
     *            string - Your Banner Ad Unit ID.
     *
     * @param interstitialAdUnitId
     *            string - Your Interstitial Ad Unit ID.
     *
     * @param testMode
     *            bool - True for test mode on, false for off.
     *
     */
    public void Init(string bannerAdUnitId, string interstitialAdUnitId, bool testMode)
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().Init(bannerAdUnitId, interstitialAdUnitId, testMode);
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().Init(bannerAdUnitId, interstitialAdUnitId, testMode);
#endif
    }
Exemplo n.º 5
0
    /**
     * Load a Banner Ad.
     *
     * @param adType
     *           BannerAdType - type of the Ad.
     *
     * @param layout
     *           AdLayout - in which layout the Ad should display.
     *
     * @param hide
     *           bool - whether the ad should keep being invisible after loaded,
     *                  true for making the ad hidden, false for showing the
     *                  ad immediately. if the parameter is set to true, then
     *                  you need to programmatically display the ad by calling
     *                  ShowBannerAd() after you get notified with event
     *                  OnReceiveAd from AdmobAdListener.
     *
     */
    public void LoadBannerAd(BannerAdType adType, AdLayout layout, bool hide)
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().LoadBannerAd((int)adType, (int)layout, 0, 0, hide, null);
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().LoadBannerAd((int)adType, (int)layout, 0, 0, hide, null);
#endif
    }
Exemplo n.º 6
0
    /**
     * Load an Interstitial Ad.
     *
     * @param hide
     *           bool - whether the ad should keep being invisible after loaded,
     *                  true for making the ad hidden, false for showing the
     *                  ad immediately. if the parameter is set to true, then
     *                  you need to programmatically display the ad by calling
     *                  ShowInterstitialAd() after you get notified with event
     *                  OnReceiveAdInterstitial from AdmobAdListener.
     *
     * @param extras
     *           Dictionary<string, string> - The extra parameters of Ad request.
     */
    public void LoadInterstitialAd(bool hide, Dictionary <string, string> extras)
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().LoadInterstitialAd(hide, extras);
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().LoadInterstitialAd(hide, extras);
#endif
    }
Exemplo n.º 7
0
    /**
     * Set test mode.
     *
     * @param testMode
     *             bool - true for test mode On, false for test mode Off.
     */
    public void SetTestMode(bool testMode)
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().SetTestMode(testMode);
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().SetTestMode(testMode);
#endif
    }
Exemplo n.º 8
0
    /**
     * Load an Interstitial Ad.
     *
     * @param hide
     *           bool - whether the ad should keep being invisible after loaded,
     *                  true for making the ad hidden, false for showing the
     *                  ad immediately. if the parameter is set to true, then
     *                  you need to programmatically display the ad by calling
     *                  ShowInterstitialAd() after you get notified with event
     *                  OnReceiveAdInterstitial from AdmobAdListener.
     */
    public void LoadInterstitialAd(bool hide)
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().LoadInterstitialAd(hide, null);
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().LoadInterstitialAd(hide, null);
#endif
    }
Exemplo n.º 9
0
    /**
     * Reposition the Banner Ad.
     *
     * @param layout
     *           AdLayout - In which layout the Ad should display.
     *
     * @param offsetX
     *           int - The horizontal offset of the Ad, if the layout is set to left,
     *                 the offset is from the left edge of screen to the left edge of
     *                 the Ad; if the layout is set to right, the offset is from the
     *                 right edge of screen to the right edge of the Ad.
     *                 The offset is in pixels.
     *
     * @param offsetY
     *           int - The vertical offset of the Ad, if the layout is set to top,
     *                 the offset is from the top edge of screen to the top edge of
     *                 the Ad; if the layout is set to bottom, the offset is from the
     *                 bottom edge of screen to the bottom edge of the Ad.
     *                 The offset is in pixels.
     */
    public void RepositionBannerAd(AdLayout layout, int offsetX, int offsetY)
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().RepositionBannerAd((int)layout, offsetX, offsetY);
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().RepositionBannerAd((int)layout, offsetX, offsetY);
#endif
    }
Exemplo n.º 10
0
    /**
     * Refresh the Banner Ad.
     *
     * This initiates a new ad request to plugin.
     */
    public void RefreshBannerAd()
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().RefreshBannerAd();
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().RefreshBannerAd();
#endif
    }
Exemplo n.º 11
0
    /**
     * Show the Interstitial Ad.
     *
     * This sets the Interstitial ad to be visible.
     */
    public void ShowInterstitialAd()
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().ShowInterstitialAd();
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().ShowInterstitialAd();
#endif
    }
Exemplo n.º 12
0
    /**
     * Load a Banner Ad and place it at specified absolute position.
     *
     * Please note that the Ad won't display if the top or left applied
     * makes the Ad display area outside the screen.
     *
     * @param adType
     *          BannerAdType - the type of Ad.
     *
     * @param top
     *          int - the top margin (in pixels) for placing Ad in absolute position.
     *
     * @param left
     *          int - the left margin (in pixels) for placing Ad in absolute position.
     *
     * @param hide
     *           bool - whether the ad should keep being invisible after loaded,
     *                  true for making the ad hidden, false for showing the
     *                  ad immediately. if the parameter is set to true, then
     *                  you need to programmatically display the ad by calling
     *                  ShowBannerAd() after you get notified with event
     *                  OnReceiveAd from AdmobAdListener.
     */
    public void LoadBannerAd(BannerAdType adType, int top, int left, bool hide)
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().LoadBannerAd((int)adType, top, left, hide, null);
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().LoadBannerAd((int)adType, top, left, hide, null);
#endif
    }
Exemplo n.º 13
0
    /**
     * Load a Banner Ad.
     *
     * @param adType
     *           BannerAdType - Type of the Ad.
     *
     * @param layout
     *           AdLayout - In which layout the Ad should display.
     *
     * @param offsetX
     *           int - The horizontal offset of the Ad, if the layout is set to left,
     *                 the offset is from the left edge of screen to the left edge of
     *                 the Ad; if the layout is set to right, the offset is from the
     *                 right edge of screen to the right edge of the Ad.
     *                 The offset is in pixels.
     *
     * @param offsetY
     *           int - The vertical offset of the Ad, if the layout is set to top,
     *                 the offset is from the top edge of screen to the top edge of
     *                 the Ad; if the layout is set to bottom, the offset is from the
     *                 bottom edge of screen to the bottom edge of the Ad.
     *                 The offset is in pixels.
     *
     * @param hide
     *           bool - whether the ad should keep being invisible after loaded,
     *                  true for making the ad hidden, false for showing the
     *                  ad immediately. if the parameter is set to true, then
     *                  you need to programmatically display the ad by calling
     *                  ShowBannerAd() after you get notified with event
     *                  OnReceiveAd from AdmobAdListener.
     *
     * @param extras
     *           Dictionary<string, string> - The extra parameters of Ad request.
     *
     */
    public void LoadBannerAd(BannerAdType adType, AdLayout layout, int offsetX, int offsetY, bool hide,
                             Dictionary <string, string> extras)
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().LoadBannerAd((int)adType, (int)layout, offsetX, offsetY, hide, extras);
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().LoadBannerAd((int)adType, (int)layout, offsetX, offsetY, hide, extras);
#endif
    }
Exemplo n.º 14
0
    /**
     * Load a Banner Ad and place it at specified absolute position.
     *
     * Please note that the Ad won't display if the top or left applied
     * makes the Ad display area outside the screen.
     *
     * @param adType
     *          BannerAdType - the type of Ad.
     *
     * @param top
     *          int - the top margin (in pixels) for placing Ad in absolute position.
     *
     * @param left
     *          int - the left margin (in pixels) for placing Ad in absolute position.
     *
     * @param hide
     *           bool - whether the ad should keep being invisible after loaded,
     *                  true for making the ad hidden, false for showing the
     *                  ad immediately. if the parameter is set to true, then
     *                  you need to programmatically display the ad by calling
     *                  ShowBannerAd() after you get notified with event
     *                  OnReceiveAd from AdmobAdListener.
     *
     * @param extras
     *           Dictionary<string, string> - The extra parameters of Ad request.
     */
    public void LoadBannerAd(BannerAdType adType, int top, int left, bool hide,
                             Dictionary <string, string> extras)
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().LoadBannerAd((int)adType, top, left, hide, extras);
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().LoadBannerAd((int)adType, top, left, hide, extras);
#endif
    }
Exemplo n.º 15
0
    /**
     * Load a Banner Ad and show it it immediately once loaded.
     *
     * @param adType
     *           BannerAdType - type of the Ad.
     *
     * @param layout
     *           AdLayout - in which layout the Ad should display.
     *
     */
    public void LoadBannerAd(BannerAdType adType, AdLayout layout)
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().LoadBannerAd((int)adType, (int)layout, 0, 0, false, null, 0);
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().LoadBannerAd((int)adType, (int)layout, 0, 0, false, null, 0);
#endif
#if UNITY_WP8
        AdmobAdWP.Instance().LoadBannerAd((int)adType, (int)layout, 0, 0, false, null, 0);
#endif
    }
Exemplo n.º 16
0
    /**
     * Hide the Banner Ad.
     *
     * This sets the banner ad to be invisible again.
     */
    public void HideBannerAd()
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().HideBannerAd();
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().HideBannerAd();
#endif
#if UNITY_WP8
        AdmobAdWP.Instance().HideBannerAd();
#endif
    }
Exemplo n.º 17
0
    /**
     * Load a Banner Ad and place it at specified absolute position, and
     * show it immediately once loaded.
     *
     * Please note that the Ad won't display if the top or left applied
     * makes the Ad display area outside the screen.
     *
     * @param adType
     *          BannerAdType - the type of Ad.
     *
     * @param top
     *          int - the top margin (in pixels) for placing Ad in absolute position.
     *
     * @param left
     *          int - the left margin (in pixels) for placing Ad in absolute position.
     *
     */
    public void LoadBannerAd(BannerAdType adType, int top, int left)
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().LoadBannerAd((int)adType, top, left, false, null, 0);
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().LoadBannerAd((int)adType, top, left, false, null, 0);
#endif
#if UNITY_WP8
        AdmobAdWP.Instance().LoadBannerAd((int)adType, top, left, false, null, 0);
#endif
    }
Exemplo n.º 18
0
    /**
     * Load a Banner Ad.
     *
     * @param adSize
     *           Vector2 - Customized size of the Ad.
     *
     *           adSize.x - The width of the Ad, in pixels.
     *           adSize.y - The height of the Ad, in pixels.
     *
     * @param layout
     *           AdLayout - In which layout the Ad should display.
     */
    public void LoadBannerAd(Vector2 adSize, AdLayout layout)
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().LoadBannerAd(adSize, (int)layout, Vector2.zero, false, null, 0);
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().LoadBannerAd(adSize, (int)layout, Vector2.zero, false, null, 0);
#endif
#if UNITY_WP8
        AdmobAdWP.Instance().LoadBannerAd(adSize, (int)layout, Vector2.zero, false, null, 0);
#endif
    }
Exemplo n.º 19
0
    /**
     * Load a Banner Ad.
     *
     * @param adType
     *           BannerAdType - Type of the Ad.
     *
     * @param layout
     *           AdLayout - In which layout the Ad should display.
     *
     * @param offset
     *           Vector2 - The offset of the Ad.
     *
     *           offset.x - The horizontal offset of the Ad, if the layout is set to left,
     *                 the offset is from the left edge of screen to the left edge of
     *                 the Ad; if the layout is set to right, the offset is from the
     *                 right edge of screen to the right edge of the Ad.
     *                 The offset is in pixels.
     *           offset.y - The vertical offset of the Ad, if the layout is set to top,
     *                 the offset is from the top edge of screen to the top edge of
     *                 the Ad; if the layout is set to bottom, the offset is from the
     *                 bottom edge of screen to the bottom edge of the Ad.
     *                 The offset is in pixels.
     *
     * @param hide
     *           bool - whether the ad should keep being invisible after loaded,
     *                  true for making the ad hidden, false for showing the
     *                  ad immediately. if the parameter is set to true, then
     *                  you need to programmatically display the ad by calling
     *                  ShowBannerAd() after you get notified with event
     *                  OnReceiveAd from AdmobAdListener.
     *
     */
    public void LoadBannerAd(BannerAdType adType, AdLayout layout, Vector2 offset, bool hide)
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().LoadBannerAd((int)adType, (int)layout, offset, hide, null, 0);
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().LoadBannerAd((int)adType, (int)layout, offset, hide, null, 0);
#endif
#if UNITY_WP8
        AdmobAdWP.Instance().LoadBannerAd((int)adType, (int)layout, offset, hide, null, 0);
#endif
    }
Exemplo n.º 20
0
    /**
     * Reposition the Banner Ad.
     *
     * @param layout
     *           AdLayout - In which layout the Ad should display.
     */
    public void RepositionBannerAd(AdLayout layout)
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().RepositionBannerAd((int)layout, 0, 0);
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().RepositionBannerAd((int)layout, 0, 0);
#endif
#if UNITY_WP8
        AdmobAdWP.Instance().RepositionBannerAd((int)layout, 0, 0);
#endif
    }
Exemplo n.º 21
0
    /**
     * Enable Ads (Banners and Interstitials).
     *
     * This function is for re-enabling the Ads after you called DisableAd().
     * After calling this function, you will be able to call LoadBannerAd() or
     * LoadInterstitialAd() then. And if the "Auto Load" switch is turned on, the
     * Ad will continue to be served then.
     * Persistent state is also taken care of, you don't need to set any variables
     * in the PlayerPrefs either.
     */
    public void EnableAd()
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().EnableAd();
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().EnableAd();
#endif
#if UNITY_WP8
        AdmobAdWP.Instance().EnableAd();
#endif
    }
Exemplo n.º 22
0
    /**
     * Load an Interstitial Ad and show it immediately once loaded.
     */
    public void LoadInterstitialAd()
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().LoadInterstitialAd(false, null, 0);
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().LoadInterstitialAd(false, null, 0);
#endif
#if UNITY_WP8
        AdmobAdWP.Instance().LoadInterstitialAd(false, null, 0);
#endif
    }
Exemplo n.º 23
0
    /**
     * Initialization, set the Ad Unit IDs.
     *
     * This function is for the new Admob frond-end.
     * NOTE: the Ad Unit ID is in the following form:
     * ca-app-pub-XXXXXXXXXXXXXXXX/NNNNNNNNNN
     *
     * @param bannerAdUnitId
     *            string - Your Banner Ad Unit ID.
     *
     * @param interstitialAdUnitId
     *            string - Your Interstitial Ad Unit ID.
     *
     */
    public void Init(string bannerAdUnitId, string interstitialAdUnitId)
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().Init(bannerAdUnitId, interstitialAdUnitId, false);
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().Init(bannerAdUnitId, interstitialAdUnitId, false);
#endif
#if UNITY_WP8
        AdmobAdWP.Instance().Init(bannerAdUnitId, interstitialAdUnitId, false);
#endif
    }
Exemplo n.º 24
0
    /**
     * Load a Banner Ad.
     *
     * @param adSize
     *           Vector2 - Customized size of the Ad.
     *
     *           adSize.x - The width of the Ad, in pixels.
     *           adSize.y - The height of the Ad, in pixels.
     *
     * @param layout
     *           AdLayout - In which layout the Ad should display.
     *
     * @param offset
     *           Vector2 - The offset of the Ad.
     *
     *           offset.x - The horizontal offset of the Ad, if the layout is set to left,
     *                 the offset is from the left edge of screen to the left edge of
     *                 the Ad; if the layout is set to right, the offset is from the
     *                 right edge of screen to the right edge of the Ad.
     *                 The offset is in pixels.
     *           offset.y - The vertical offset of the Ad, if the layout is set to top,
     *                 the offset is from the top edge of screen to the top edge of
     *                 the Ad; if the layout is set to bottom, the offset is from the
     *                 bottom edge of screen to the bottom edge of the Ad.
     *                 The offset is in pixels.
     *
     * @param hide
     *           bool - whether the ad should keep being invisible after loaded,
     *                  true for making the ad hidden, false for showing the
     *                  ad immediately. if the parameter is set to true, then
     *                  you need to programmatically display the ad by calling
     *                  ShowBannerAd() after you get notified with event
     *                  OnReceiveAd from AdmobAdListener.
     *
     * @param extras
     *           Dictionary<string, string> - The extra parameters of Ad request.
     *
     * @param tagForChildren
     *           TagForChildrenDirectedTreatment - Set TagForChildrenDirectedTreatment flag,
     *           More information, please refer to:
     *           https://developers.google.com/mobile-ads-sdk/docs/admob/additional-controls#play-coppa
     *
     *           Valid values:
     *
     *	         Unset - Ad requests will include no indication of how you would like your content treated
     *                   with respect to COPPA.
     *
     *           Yes - You will indicate that your content should be treated as child-directed for
     *                 purposes of COPPA.
     *
     *           No - You will indicate that your content should NOT be treated as child-directed for
     *                purposes of COPPA.
     *
     */
    public void LoadBannerAd(Vector2 adSize, AdLayout layout, Vector2 offset, bool hide,
                             Dictionary <string, string> extras, TagForChildrenDirectedTreatment tagForChildren)
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().LoadBannerAd(adSize, (int)layout, offset, hide, extras, (int)tagForChildren);
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().LoadBannerAd(adSize, (int)layout, offset, hide, extras, (int)tagForChildren);
#endif
#if UNITY_WP8
        AdmobAdWP.Instance().LoadBannerAd(adSize, (int)layout, offset, hide, extras, (int)tagForChildren);
#endif
    }
Exemplo n.º 25
0
    /**
     * Load an Interstitial Ad.
     *
     * @param hide
     *           bool - whether the ad should keep being invisible after loaded,
     *                  true for making the ad hidden, false for showing the
     *                  ad immediately. if the parameter is set to true, then
     *                  you need to programmatically display the ad by calling
     *                  ShowInterstitialAd() after you get notified with event
     *                  OnReceiveAdInterstitial from AdmobAdListener.
     *
     * @param extras
     *           Dictionary<string, string> - The extra parameters of Ad request.
     */
    public void LoadInterstitialAd(bool hide, Dictionary <string, string> extras,
                                   TagForChildrenDirectedTreatment tagForChildren)
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().LoadInterstitialAd(hide, extras, (int)tagForChildren);
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().LoadInterstitialAd(hide, extras, (int)tagForChildren);
#endif
#if UNITY_WP8
        AdmobAdWP.Instance().LoadInterstitialAd(hide, extras, (int)tagForChildren);
#endif
    }
Exemplo n.º 26
0
    /**
     * Load a Banner Ad and place it at specified absolute position.
     *
     * Please note that the Ad won't display if the top or left applied
     * makes the Ad display area outside the screen.
     *
     * @param adType
     *          BannerAdType - the type of Ad.
     *
     * @param top
     *          int - the top margin (in pixels) for placing Ad in absolute position.
     *
     * @param left
     *          int - the left margin (in pixels) for placing Ad in absolute position.
     *
     * @param hide
     *           bool - whether the ad should keep being invisible after loaded,
     *                  true for making the ad hidden, false for showing the
     *                  ad immediately. if the parameter is set to true, then
     *                  you need to programmatically display the ad by calling
     *                  ShowBannerAd() after you get notified with event
     *                  OnReceiveAd from AdmobAdListener.
     *
     * @param extras
     *           Dictionary<string, string> - The extra parameters of Ad request.
     *
     * @param tagForChildren
     *           TagForChildrenDirectedTreatment - Set TagForChildrenDirectedTreatment flag,
     *           More information, please refer to:
     *           https://developers.google.com/mobile-ads-sdk/docs/admob/additional-controls#play-coppa
     *
     *           Valid values:
     *
     *	         Unset - Ad requests will include no indication of how you would like your content treated
     *                   with respect to COPPA.
     *
     *           Yes - You will indicate that your content should be treated as child-directed for
     *                 purposes of COPPA.
     *
     *           No - You will indicate that your content should NOT be treated as child-directed for
     *                purposes of COPPA.
     *
     */
    public void LoadBannerAd(BannerAdType adType, int top, int left, bool hide,
                             Dictionary <string, string> extras,
                             TagForChildrenDirectedTreatment tagForChildren)
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().LoadBannerAd((int)adType, top, left, hide, extras, (int)tagForChildren);
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().LoadBannerAd((int)adType, top, left, hide, extras, (int)tagForChildren);
#endif
#if UNITY_WP8
        AdmobAdWP.Instance().LoadBannerAd((int)adType, top, left, hide, extras, (int)tagForChildren);
#endif
    }
Exemplo n.º 27
0
    /**
     * Check if Ad is enabled or not.
     *
     * This function is for getting the current state of the Ad.
     *
     * @result bool - True if the Ad is enabled, false if the Ad has
     *                been disabled by calling DisableAd().
     */
    public bool IsAdEnabled()
    {
        bool result = true;

#if UNITY_ANDROID
        result = AdmobAdAndroid.Instance().IsAdEnabled();
#endif
#if UNITY_IPHONE
        result = AdmobAdIOS.Instance().IsAdEnabled();
#endif
#if UNITY_WP8
        result = AdmobAdWP.Instance().IsAdEnabled();
#endif
        return(result);
    }
Exemplo n.º 28
0
    /**
     * Get the size of Banner Ad in pixels.
     *
     * This function is for getting the banner's actual size in pixels.
     *
     * @result Vector2 - The width and height, x for width, y for height.
     */
    public Vector2 GetAdSizeInPixels(BannerAdType adType)
    {
        Vector2 result = Vector2.zero;

#if UNITY_ANDROID
        result = AdmobAdAndroid.Instance().GetAdSizeInPixels((int)adType);
#endif
#if UNITY_IPHONE
        result = AdmobAdIOS.Instance().GetAdSizeInPixels((int)adType);
#endif
#if UNITY_WP8
        result = AdmobAdWP.Instance().GetAdSizeInPixels((int)adType);
#endif
        return(result);
    }