/** * 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 }
/** * 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 }
/** * 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 }
/** * 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 }
/** * 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 }
/** * 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 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. * * @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, AdLayout layout, Vector2 offset, bool hide, Dictionary <string, string> extras, TagForChildrenDirectedTreatment tagForChildren) { #if UNITY_ANDROID AdmobAdAndroid.Instance().LoadBannerAd((int)adType, (int)layout, offset, hide, extras, (int)tagForChildren); #endif #if UNITY_IPHONE AdmobAdIOS.Instance().LoadBannerAd((int)adType, (int)layout, offset, hide, extras, (int)tagForChildren); #endif #if UNITY_WP8 AdmobAdWP.Instance().LoadBannerAd((int)adType, (int)layout, offset, hide, extras, (int)tagForChildren); #endif }
/** * 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); }