简体   繁体   English

Windows Phone 7上AdMob的有效解决方案

[英]Working solution for AdMob on Windows Phone 7

I tried 2 possible way to show AdMob ads but none works. 我尝试了两种显示AdMob广告的方法,但没有一种有效。 First I tried this but I get error in Output window (one line was False, another something with pdb file and so). 首先,我尝试了此操作,但是在“输出”窗口中出现错误(一行为False,另一行为pdb文件,依此类推)。 Then I tried google and found old version of Google Ads SDK for WP7. 然后,我尝试了google,并找到了适用于WP7的旧版Google Ads SDK。 Now I am getting in Output windows: An exception of type 'System.UnauthorizedAccessException' occurred in Microsoft.Phone.ni.dll and wasn't handled before a managed/native boundary So is there working solution for AdMob on Windows Phone 7? 现在,我进入“输出”窗口: An exception of type 'System.UnauthorizedAccessException' occurred in Microsoft.Phone.ni.dll and wasn't handled before a managed/native boundary那么在Windows Phone 7上有AdMob的有效解决方案吗? Thanks 谢谢

I think Ad Rotator is a good option, because it still actively maintained and support multiple Ad providers (including AdMob). 我认为Ad Rotator是一个不错的选择,因为它仍然积极维护并支持多个广告提供商(包括AdMob)。 You can simply put Ad Rotator control in your application Page : 您只需将Ad Rotator控件放入应用程序页面中:

<adRotator:AdRotatorControl x:Name="AdRotatorControl" 
xmlns:adRotator="clr-namespace:AdRotator;assembly=AdRotator"
Width="480" Height="80"
    SettingsUrl="http://mydomain.com/myAdSettings.xml"
    DefaultAdType="AdMob"
    DefaultSettingsFileUri="/AppAssemblyName;component/defaultAdSettings.xml"
    AdMobAdUnitId="xxxxxxxxxxxxxx"
    SlidingAdDirection="Left"
    SlidingAdDisplaySeconds="10"
    SlidingAdHiddenSeconds="20"/>

Then in page loaded event, call Invalidate method to reload ads : 然后在页面加载事件中,调用Invalidate方法重新加载广告:

void Page_Loaded(object sender, RoutedEventArgs e)
{
    AdRotatorControl.Invalidate();
}

Note: You have to provide Ads configuration in xml format, the file that refered as defaultAdSettings.xml in above sample. 注意:您必须以xml格式提供Ads配置,该文件在上面的示例中称为defaultAdSettings.xml。 Refer to Ad Rotator project documentation for information about the format of the file. 有关文件格式的信息,请参阅Ad Rotator项目文档 Also check tutorial on getting started to use Ad Rotator here , written by the creator of Ad Rotator. 还要检查入门使用广告轮播器教程在这里 ,通过广告旋转的创造者写的。

Actually I haven't tried this, but it looks promising. 其实我还没有尝试过,但是看起来很有希望。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM