Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Talk:Implementing advert in Windows Phone app using Inneractive with CSharp

From Wiki
Jump to: navigation, search

Contents

Hamishwillee - Thanks very much Spaso

This is a really useful and helpful article. I've subedited it slightly for our wiki style and for minor English corrections. Also added link to your original blog in "references".

I've also added link to Windows Phone SDK guidelines (Inneractive wiki). These are really good instructions and while generally I don't like duplication of content I think your article is actually fairly complementary - especially with the downloadable example.

Can you tell me what device(s) you have tested this code on? Normally we list this in the ArticleMetaData so that in future people know where this code was "known good".

Thanks again for posting this. Much appreciated.

Regards

Hamish

hamishwillee 03:09, 10 May 2013 (EEST)

ZeroInfinite - Unspecified Error

Hi, I seem to be getting an error message, "Unspecified error" on the line DisplayAd even after following all the steps outline in the above article? Any idea, why? Thanks.

ZeroInfinite (talk) 16:46, 1 September 2013 (EEST)

SB Dev -

With the last edit the following code was added: && nax_control.Children.Count() == 0

This serves obviously to avoid adding the NAX control each time the page is navigated to. Perhaps the reason for such additions should be stated in a comment on the code or in the describing text so people know what to look out for when implementing it themselves (if they don't just copy & paste it). I'm mainly mentioning it because I ran into the issue recently.

As for the comment by ZeroInfinite: you're not really following this sample but are using the "DisplayAd"-method, which isn't used in this article. You might want to try initializing the control in a similar way to what is described here and add the control to a dedicated container. Otherwise you might try and post your code that is producing the error in the NAX Discussion Board here: http://developer.nokia.com/Community/Discussion/forumdisplay.php/291-Monetization-APIs which is more likely to get a timely response.

SB Dev (talk) 21:56, 9 September 2013 (EEST)

Spaso Lazarevic - Errors

Sorry fo late comment. First, ZeroInfinite if you use provided code sample from the Source file section (Media:NAXApp.zip) your code must run without error.

Second, I added commnet for nax_control.Childred.Count()==0 in code on this page (not in the sample NAXApp.zip). It is mainly and only for stopping create many banners on one page as SB Dev said.

Best regards

Spaso Lazarevic (talk) 16:19, 22 September 2013 (EEST)

Tammind - Backgroung Thread

Hello! I added a NAX banner to my app in XAML, but now my app is freezing on few seconds when i navigate to page with ad.

I have a question: is it possible to download ad banner in background thread?

Tammind (talk) 21:05, 2 October 2013 (EEST)

Mfabiop - Re: Background Thread

I got the same problem,

And i'm affraid of the submission will failed because of these seconds.

Anyway, you can add the ad in background using C# instead of XAML.

Put this in your OnNavigatedTo method.

Task.Run(() =>
{
Dictionary<InneractiveAd.IaOptionalParams, string> optionalParams = new Dictionary<InneractiveAd.IaOptionalParams, string>();
optionalParams.Add(InneractiveAd.IaOptionalParams.Key_Ad_Alignment, InneractiveAd.IaAdAlignment.CENTER.ToString());
optionalParams.Add(InneractiveAd.IaOptionalParams.Key_OptionalAdWidth, "480");
optionalParams.Add(InneractiveAd.IaOptionalParams.Key_OptionalAdHeight, "80");
 
Dispatcher.BeginInvoke(() =>
{
 
InneractiveAd iaBanner = new InneractiveAd("abc123", InneractiveAd.IaAdType.IaAdType_Banner, 60, optionalParams);
 
iaBanner.SetValue(Grid.RowProperty, 2);
iaBanner.Width = 480;
iaBanner.Height = 80;
 
LayoutRoot.Children.Add(iaBanner);
});
The application will open normally, but the ad will show as soon as it is ready.

mfabiop (talk) 14:29, 6 October 2013 (EEST)

Mfabiop - Re: Background Thread

Sorry,

I don't know how to put code in wiki comments :)

mfabiop (talk) 14:40, 6 October 2013 (EEST)

Hamishwillee - Code in wiki comments

Same way as in wiki - use code open and close tags :-)

Wiki comments are just the talk page for the wiki page, displayed inline rather than as another tab.

hamishwillee (talk) 05:40, 7 October 2013 (EEST)

Bigmachini - Re: Background Thread

I got the same problem,

And i'm affraid of the submission will failed because of these seconds.

Anyway, you can add the ad in background using C# instead of XAML.

Put this in your OnNavigatedTo method.

Task.Run(() => {

   Dictionary<InneractiveAd.IaOptionalParams, string> optionalParams = new Dictionary<InneractiveAd.IaOptionalParams, string>();
   optionalParams.Add(InneractiveAd.IaOptionalParams.Key_Ad_Alignment, InneractiveAd.IaAdAlignment.CENTER.ToString());
   optionalParams.Add(InneractiveAd.IaOptionalParams.Key_OptionalAdWidth, "480");
   optionalParams.Add(InneractiveAd.IaOptionalParams.Key_OptionalAdHeight, "80");

   Dispatcher.BeginInvoke(() =>
   {

   InneractiveAd iaBanner = new InneractiveAd("abc123", InneractiveAd.IaAdType.IaAdType_Banner, 60, optionalParams);

   iaBanner.SetValue(Grid.RowProperty, 2);
   iaBanner.Width = 480;
   iaBanner.Height = 80;

   LayoutRoot.Children.Add(iaBanner);

}); The application will open normally, but the ad will show as soon as it is ready.

i tried the above but the code is still hanging when for a while the add is to show. does it have to be in the onnavigated to page or can i put it elsewhere

Bigmachini (talk) 01:20, 18 November 2013 (EET)

Bigmachini - Background thread

Here is an incorporated version with the background thread added

http://bigmachini.blogspot.com/2013/11/implementing-advert-in-windows-phone.html

Bigmachini (talk) 02:03, 18 November 2013 (EET)

Hamishwillee - Thanks Bigmachini

Hi Bigmachini

This is a wiki article - could you perhaps update this article and code with your implementation with background thread?

Regards

Hamish

hamishwillee (talk) 02:16, 18 November 2013 (EET)

 

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×