Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Adding Ads Into Cocos2D-x v3.6 Windows Phone App

  • You cannot reply to this topic
11 replies to this topic

#1 texel3d   Members   -  Reputation: 139

Like
0Likes
Like

Posted 26 June 2015 - 06:18 AM

Hi,

 

How can i add Ads into Universal Windows Phone App generated from Cocos2D-X v3.6 ?

All tutorials i have found seems outdated. Nothings seems to work for me :(

 

Thanks.



Sponsor:

#2 frob   Moderators   -  Reputation: 29877

Like
1Likes
Like

Posted 26 June 2015 - 03:36 PM

What have you tried? What didn't work? What were your exact errors?

 

/Edit:

 

Nevermind.  

 

I just psychically realized it is line 1275 of your ad loader.  You forgot a semicolon.

 

:-)


Edited by frob, 26 June 2015 - 03:38 PM.
Hopefully fun reminder about posting code questions.

Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.

Also check out my personal website at bryanwagstaff.com, where I write about assorted stuff.


#3 texel3d   Members   -  Reputation: 139

Like
0Likes
Like

Posted 26 June 2015 - 05:09 PM

I don't know exactelly what to do.

 

I have added Microsoft Advertising SDK for Windows Phone 8.1 (XAML) to the Wndows Phone project of the Universal App Solution generated by the Cocos2D-x Tools.

 
In OpenGLESPage.xaml (in shared project), i have added:
xmlns:UI="using:Microsoft.Advertising.Media.UI" on the top of the xaml page
I have added in the page:
<UI:AdControl ApplicationId="d25517cb-12d4-4699-8bdc-52040c712cab"

AdUnitId="10043107"
HorizontalAlignment="Left"
Height="250"
VerticalAlignment="Top"
Width="250"/>

 

I have this error:

Error    1    The type 'UI:AdControl' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.    C:\Dev\cocos\MyGame\proj.win8.1-universal\App.Shared\OpenGLESPage.xaml    25    26    MyGame.Windows
Error    2    The name "AdControl" does not exist in the namespace "using:Microsoft.Advertising.Media.UI".    C:\Dev\cocos\MyGame\proj.win8.1-universal\App.Shared\OpenGLESPage.xaml    25    25    MyGame.Windows
Error    3    error WMC0001: Unknown type 'AdControl' in XML namespace 'using:Microsoft.Advertising.Media.UI'    C:\Dev\cocos\MyGame\proj.win8.1-universal\App.Shared\OpenGLESPage.xaml    25    26    MyGame.Windows
Error    4    error WMC0001: Unknown type 'AdControl' in XML namespace 'using:Microsoft.Advertising.Media.UI'    C:\Dev\cocos\MyGame\proj.win8.1-universal\App.Shared\OpenGLESPage.xaml    25    26    MyGame.WindowsPhone


Edited by texel3d, 26 June 2015 - 05:53 PM.


#4 Dave Hunt   Crossbones+   -  Reputation: 3473

Like
0Likes
Like

Posted 26 June 2015 - 07:09 PM


Error    1    The type 'UI:AdControl' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.

Have you done this? You added a using directive, but did you add the appropriate assembly to your project's assembly references.


Edited by Dave Hunt, 26 June 2015 - 07:10 PM.


#5 texel3d   Members   -  Reputation: 139

Like
0Likes
Like

Posted 27 June 2015 - 04:32 AM

I think so. I have right click on the windows phone project -> add -> References -> Add new references -> Windows Phones 8.1 -> extension -> Microsoft Advertising SDK for windows phone 8.1 (XAML)



#6 Dave Hunt   Crossbones+   -  Reputation: 3473

Like
0Likes
Like

Posted Yesterday, 10:03 AM

I believe the correct namespace for AdControl is Microsoft.Advertising.WinRT.UI.

 

See API Reference - Ad SDK Windows 8.1



#7 texel3d   Members   -  Reputation: 139

Like
0Likes
Like

Posted Yesterday, 12:29 PM

It's the same thing:
 
Error 2 Undefined namespace. The 'using' URI refers to a namespace 'Microsoft.Advertising.WinRT.UI' that could not be found. C:\Dev\cocos\MyGame\proj.win8.1-universal\App.Shared\OpenGLESPage.xaml 8 14 MyGame.Windows
Error 3 The type 'UI:AdControl' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. C:\Dev\cocos\MyGame\proj.win8.1-universal\App.Shared\OpenGLESPage.xaml 25 26 MyGame.Windows
Error 1 The name "AdControl" does not exist in the namespace "using:Microsoft.Advertising.WinRT.UI". C:\Dev\cocos\MyGame\proj.win8.1-universal\App.Shared\OpenGLESPage.xaml 25 25 MyGame.Windows
Error 4 error WMC0001: Unknown type 'AdControl' in XML namespace 'using:Microsoft.Advertising.WinRT.UI' C:\Dev\cocos\MyGame\proj.win8.1-universal\App.Shared\OpenGLESPage.xaml 25 26 MyGame.WindowsPhone


#8 Dave Hunt   Crossbones+   -  Reputation: 3473

Like
0Likes
Like

Posted Yesterday, 01:01 PM

Sorry about that. I was looking at Windows, not Windows Phone. The correct namespace is Microsoft.Advertising.Mobile.UI.

 

See Windows Phone 8.1 XAML Apps - Integrating the AdControl using XAML Markup



#9 texel3d   Members   -  Reputation: 139

Like
0Likes
Like

Posted Yesterday, 03:25 PM

As i say, i have already tried it.



#10 Dave Hunt   Crossbones+   -  Reputation: 3473

Like
0Likes
Like

Posted Yesterday, 05:57 PM

Um. Where do you say you've already tried it? Your errors show you tried Microsoft.Advertising.Media.UI and Microsoft.Advertising.WinRT.UI. Are you sure you tried Microsoft.Advertising.Mobile.UI?



#11 texel3d   Members   -  Reputation: 139

Like
0Likes
Like

Posted Today, 05:53 AM

Sorry for the mistake. I have also tried it and i have:

 

Error 2 Undefined namespace. The 'using' URI refers to a namespace 'Microsoft.Advertising.Mobile.UI' that could not be found. C:\Dev\cocos\MyGame\proj.win8.1-universal\App.Shared\OpenGLESPage.xaml 8 14 MyGame.Windows
Error 3 The type 'UI:AdControl' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. C:\Dev\cocos\MyGame\proj.win8.1-universal\App.Shared\OpenGLESPage.xaml 25 26 MyGame.Windows
Error 1 The name "AdControl" does not exist in the namespace "using:Microsoft.Advertising.Mobile.UI". C:\Dev\cocos\MyGame\proj.win8.1-universal\App.Shared\OpenGLESPage.xaml 25 25 MyGame.Windows
Error 4 error WMC0001: Unknown type 'AdControl' in XML namespace 'using:Microsoft.Advertising.Mobile.UI' C:\Dev\cocos\MyGame\proj.win8.1-universal\App.Shared\OpenGLESPage.xaml 25 26 MyGame.Windows


#12 Dave Hunt   Crossbones+   -  Reputation: 3473

Like
0Likes
Like

Posted Today, 07:26 AM

I would suggest stepping through the walkthrough I linked above and see if you can get that to work. If that works, then you can see what's different with your cocos2d project.







PARTNERS