c# - Microsoft advertising SDK for windows phone 8 (XAML) -
I want to add an ad to my app.
This is my XML
This is my code
public manpage () {InitializeComponent (); Thread.Sleep (1000); AdUnit.ErrorOccurred + = AdUnit_ErrorOccurred; // ApplicationBar // BuildLocalizedApplicationBar () sample code for localization; } Void AdUnit_ErrorOccurred (object sender, Microsoft.Advertising.AdErrorEventArgs e) {System.Diagnostics.Debug.WriteLine ( "Ad error" + e.Error.Message.ToString ()); }
When I have null reference
for this device deployed
AdUnit.ErrorOccurred + AdUnit_ErrorOccurred;
I followed everything from MSDN. I am using VS2013.
Make sure that you make all a sample xaml: .cs: capabilities in its WMAppManifest: < / p>
ID_CAP_IDENTITY_USER ID_CAP_MEDIA_LIB ID_CAP_NETWORKING ID_CAP_PHONEDIALER ID_CAP_WEBBROWSERCOMPONENT
& lt; my: AdControl visibility = "visible" ErrorOccurred = "OnAdError_ErrorOccurred" AdUnitId = "10020750" ApplicationId = "e1e3c23b-3a59-4119-852e-8ad0a7f78f11" height = "80" HorizontalAlignment = "left" Margin = "- 12,6,0 , 0 "name =" AdControl1 "vertical alignment =" top "width =" 480 "/>
Microsoft's use advertisement. mobile. UI; Namespace WP_AdApp {Public Partial Class Home Page: Phone Application Page {Private AdControl adControl; Private contact string APPLICATION_ID = "e1e3c23b-3a59-4119-852e-8ad0a7f78f11"; Private consultation string AD_UNITID = "10020750"; Public ManPage () {InitializeComponent (); Loaded = new routing event handler (manpage_loaded); } Private void OnAdError_ErrorOccurred (object sender, Microsoft.Advertising.AdErrorEventArgs e) {MessageBox.Show ( "AdControl Error:" + e.Error.Message);
Comments
Post a Comment