Esempio n. 1
0
    public static AdSize getBannerSize()
    {
        AdSize bannerSize = AdSize.GetPortraitAnchoredAdaptiveBannerAdSizeWithWidth(AdSize.FullWidth);

        Debug.Log("FullWidth: " + AdSize.FullWidth);
        Debug.Log("Banner Width: " + bannerSize.Width);
        Debug.Log("Banner Height: " + bannerSize.Height);
        Debug.Log("DEVICE SCALE: " + MobileAds.Utils.GetDeviceScale());
        DevManager.Instance.Set(22, "Banner Width: " + bannerSize.Width);
        DevManager.Instance.Set(23, "Banner Height: " + bannerSize.Height);
        DevManager.Instance.Set(24, "Device Scale: " + MobileAds.Utils.GetDeviceScale());
        return(bannerSize);
    }
Esempio n. 2
0
    //横幅广告
    public void RequestBanner()
    {
        Debug.Log("yyy加载Banner");
#if UNITY_ANDROID
        string adUnitId = BannerId;            //正式ca-app-pub-6562789771066579/4154052916
#elif UNITY_IOS
        string adUnitId = BannerId_IOS;
#else
        string adUnitId = "ca-app-pub-3940256099942544/6300978111";
#endif


        UMengAnalyticsController.Instance.PrepAd(11);
        AdSize adaptiveSize =
            AdSize.GetPortraitAnchoredAdaptiveBannerAdSizeWithWidth(AdSize.FullWidth);
        this.bannerView = new BannerView(adUnitId, adaptiveSize, AdPosition.Bottom);
        AdRequest request = new AdRequest.Builder().Build();

        this.bannerView.OnAdLoaded       += onBannerLoaded;
        this.bannerView.OnAdFailedToLoad += onIBannerAdLoadedFiled;
        bannerView.LoadAd(request);
    }