广告无法正常显示

时间:2015-04-12 22:49:38

标签: c# windows windows-phone-8 visual-studio-2013 admob

我正在尝试在简单的测验应用中添加插页式广告。在10个问题之后,应显示插页式广告。广告出现了,但在几秒钟内消失而没有被解雇。有什么问题?

private void OnAdReceived(object sender, AdEventArgs e)
{
    System.Diagnostics.Debug.WriteLine("Ad received successfully");
    ad.ShowAd();
}
    private void next_Click(object sender, RoutedEventArgs e)
    {
        option1.Visibility = Visibility.Visible;
        option2.Visibility = Visibility.Visible;
        option3.Visibility = Visibility.Visible;
        option4.Visibility = Visibility.Visible;
        question.Visibility = Visibility.Visible;
        a.Visibility = Visibility.Visible;
        b.Visibility = Visibility.Visible;
        c.Visibility = Visibility.Visible;
        d.Visibility = Visibility.Visible;
        button.Visibility = Visibility.Visible ;
        next.Visibility = Visibility.Collapsed;
        answer.Visibility = Visibility.Collapsed;
        VibrationDevice v = VibrationDevice.GetDefault();
        v.Vibrate(TimeSpan.FromSeconds(0.1));
        Random rnd = new Random();
        if(tot%10==0)
        {
            ad = new InterstitialAd("admob_id");
            AdRequest adRequest = new AdRequest();
            // Enable test ads.
            adRequest.ForceTesting = true;

            ad.ReceivedAd += OnAdReceived;
            ad.LoadAd(adRequest);
            ad.DismissingOverlay += ad_DismissingOverlay;
        }

        num = shuffle[tot];
        tot++;
        question.Text = sat[num];
        option1.Text = opt[num, 0];
        option2.Text = opt[num, 1];
        option3.Text = opt[num, 2];
        option4.Text = opt[num, 3];

        a.IsChecked = true;
    }

0 个答案:

没有答案