private void FetchAndDisplay(string adspaceName)
        {
            adBanner = new FlurryAdBanner(adspaceName);

#if DEBUG
            // enable test ads
            var targeting = FlurryAdTargeting.Targeting;
            targeting.TestAdsEnabled = true;
            adBanner.Targeting       = targeting;
#endif

            adBanner.DidFetchAd += delegate {
                statusLbl.Text = string.Format(" [{0}] Did Fetch Ad ", adBanner.Space);

                adBanner.DisplayAd(View, this);
            };
            adBanner.DidRenderAd += delegate {
                statusLbl.Text = string.Format(" [{0}] Did Render Ad ", adBanner.Space);
            };
            adBanner.WillPresentFullscreen += delegate {
                statusLbl.Text = string.Format(" [{0}] Will Present Fullscreen Ad ", adBanner.Space);
            };
            adBanner.DidReceiveClick += delegate {
                statusLbl.Text = string.Format(" [{0}] Did Receive Click Ad ", adBanner.Space);
            };
            adBanner.DidDismissFullscreen += delegate {
                statusLbl.Text = string.Format(" [{0}] Did Dismiss Fullscreen Ad ", adBanner.Space);
            };
            adBanner.WillLeaveApplication += delegate {
                statusLbl.Text = string.Format(" [{0}] Will Leave Application ", adBanner.Space);
            };
            adBanner.DidFinishVideo += delegate {
                statusLbl.Text = string.Format(" [{0}] Did Finish Video ", adBanner.Space);
            };
            adBanner.WillPresentFullscreen += delegate {
                statusLbl.Text = string.Format(" [{0}] Will Present Fullscreen Ad ", adBanner.Space);
            };
            adBanner.Error += (_, e) => {
                statusLbl.Text = string.Format(" [{0}] Did Fail to Receive Ad with error [{1}] ", adBanner.Space, e.ErrorDescription);
            };

            statusLbl.Text = string.Format(" [{0}] Will Fetch Ad ", adBanner.Space);

            adBanner.FetchAd(View.Frame);
        }
示例#2
0
        private void ShowBannerAd()
        {
            if (adBanner != null)
            {
                adBanner.Destroy();
                bannerContainer.RemoveAllViews();
            }

            adBanner = new FlurryAdBanner(this, bannerContainer, "Banner");

            adBanner.Fetched += delegate {
                statusLabel.Text = "Banner.Fetched";

                adBanner.DisplayAd();
            };
            adBanner.Rendered += delegate {
                statusLabel.Text = "Banner.Rendered";
            };
            adBanner.ShowFullscreen += delegate {
                statusLabel.Text = "Banner.ShowFullscreen";
            };
            adBanner.Clicked += delegate {
                statusLabel.Text = "Banner.Clicked";
            };
            adBanner.CloseFullscreen += delegate {
                statusLabel.Text = "Banner.CloseFullscreen";
            };
            adBanner.AppExit += delegate {
                statusLabel.Text = "Banner.AppExit";
            };
            adBanner.VideoCompleted += delegate {
                statusLabel.Text = "Banner.VideoCompleted";
            };
            adBanner.Error += (_, e) => {
                statusLabel.Text = string.Format("Banner.Error [{0}] [{1}] ", e.ErrorType, e.ErrorCode);
            };

            statusLabel.Text = "Banner.FetchAd";

            adBanner.FetchAd();
        }