Example #1
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
    }
Example #2
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
    }
Example #3
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
    }
    /**
     * 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
    }
    /**
     * 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
    }
    /**
     * 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
    }
    /**
     * 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
    }
    /**
     * 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
    }