Unity3d : How to integrate AdMob - Interstitial for Windows Phone 8 (Not Unity-Plugin)
Test on:
- Mac OSX Yosemite
- MS Lumia 535 Dual Sim
- Windows 10 Preview
- Unity3d 32-bit 5.1.0f3 (For Windows)
[ Free source code]
Unity project: http://sh.st/PCLxx
Visual Studio 2013 project: http://sh.st/PCLTP
Pre-require:
- VMware Fusion (For Mac)
- Visual Studio 2013 or Above (For Windows)
- Windows Phone SDK (For Windows)
- Unity3d 32-bit/64-bit 5.1.0f3 (For Windows)
- Authenticator (For Windows Phone)
- AdMob (For Windows Phone 8) - download: https://developers.google.com/mobile-ads-sdk/download
*This tutorial for advance user that's already has all pre-require software installed properly. If you were not Mac User just focus ONLY windows software and windows os.
**Not included how to Visual Studio and Windows Phone SDK installation and setup
[Build for Windows Phone 8]
1. Open your project on windows os then goto File > Build Settings...
2. Choose "Windows Phone 8" and click "Build"
3. I'm create folder named "ExportWP8" and click "Select Folder"
4. waiting until build process successful.
5. Open "ExportWP8" folder, the .sln file ready for use in Visual Studio.
[Integrate AdMob]
1. Download AdMob (For Windows Phone 8) - here: https://developers.google.com/mobile-ads-sdk/download then extract and you should have be like this.
2. from [Build for Windows Phone 8] step 5. Open yourProjectName.sln with Visual Studio.
3. Under "Solution Explorer", right-click and choose "Add References..."
4. Click "Extension" and choose "Browse..."
5. Goto "GoogleMobileAdsSdkWindowsPhone8-6.5.13/lib/windowsphone8/" and select "GoogleAds.dll" then click "Add"
6. You should see result as below and then click "OK".
7. Now your project has GoogleAds integrated.
[AdMob Implement]
1. Next step, you need to modify and implement AdMob in your project, Open "MainPage.xaml.cs" and add 3 lines of code as below image.
using GoogleAds;
using UnityAdMobWP8.Resources; // [yourNamespace].Resources;
using System.Diagnostics; // For print debugging
2. Create variable for InterstitialAd, AdRequest, AdView, AdUnitID. You still need AdView although you not use Banner because of AdView use to represent Ads overlay on screen.
3. Under constructor "MainPage()" add many lines of code for implement AdMob type Interstitial and AdView for display as below image.
4. Add AdMob Listener for any event like below.
5. Under "Properties" section open "WMAppManifest.xml", click "Capabilities" and check all of list like this.
[/] ID_CAP_IDENTITY_DEVICE
[/] ID_CAP_IDENTITY_USER
[/] ID_CAP_MEDIALIB_AUDIO
[/] ID_CAP_MEDIALIB_PHOTO
[/] ID_CAP_MEDIALIB_PLAYBACK
[/] ID_CAP_SENSORS
[/] ID_CAP_WEBBROWSERCOMPONENT
6. Build your project by choose menu "BUILD > Build Solution".
7. Your result should be "1 succeeded" as below image, You're completed implement AdMob.
[Admob Testing]
[ Free source code]
Unity project: http://sh.st/PCLxx
Visual Studio 2013 project: http://sh.st/PCLTP
It's work. ;)
Test on:
- Mac OSX Yosemite
- MS Lumia 535 Dual Sim
- Windows 10 Preview
- Unity3d 32-bit 5.1.0f3 (For Windows)
[ Free source code]
Unity project: http://sh.st/PCLxx
Visual Studio 2013 project: http://sh.st/PCLTP
Pre-require:
- VMware Fusion (For Mac)
- Visual Studio 2013 or Above (For Windows)
- Windows Phone SDK (For Windows)
- Unity3d 32-bit/64-bit 5.1.0f3 (For Windows)
- Authenticator (For Windows Phone)
- AdMob (For Windows Phone 8) - download: https://developers.google.com/mobile-ads-sdk/download
*This tutorial for advance user that's already has all pre-require software installed properly. If you were not Mac User just focus ONLY windows software and windows os.
**Not included how to Visual Studio and Windows Phone SDK installation and setup
[Build for Windows Phone 8]
1. Open your project on windows os then goto File > Build Settings...
2. Choose "Windows Phone 8" and click "Build"
3. I'm create folder named "ExportWP8" and click "Select Folder"
4. waiting until build process successful.
5. Open "ExportWP8" folder, the .sln file ready for use in Visual Studio.
[Integrate AdMob]
1. Download AdMob (For Windows Phone 8) - here: https://developers.google.com/mobile-ads-sdk/download then extract and you should have be like this.
2. from [Build for Windows Phone 8] step 5. Open yourProjectName.sln with Visual Studio.
3. Under "Solution Explorer", right-click and choose "Add References..."
4. Click "Extension" and choose "Browse..."
5. Goto "GoogleMobileAdsSdkWindowsPhone8-6.5.13/lib/windowsphone8/" and select "GoogleAds.dll" then click "Add"
6. You should see result as below and then click "OK".
7. Now your project has GoogleAds integrated.
[AdMob Implement]
1. Next step, you need to modify and implement AdMob in your project, Open "MainPage.xaml.cs" and add 3 lines of code as below image.
using GoogleAds;
using UnityAdMobWP8.Resources; // [yourNamespace].Resources;
using System.Diagnostics; // For print debugging
2. Create variable for InterstitialAd, AdRequest, AdView, AdUnitID. You still need AdView although you not use Banner because of AdView use to represent Ads overlay on screen.
3. Under constructor "MainPage()" add many lines of code for implement AdMob type Interstitial and AdView for display as below image.
[/] ID_CAP_IDENTITY_DEVICE
[/] ID_CAP_IDENTITY_USER
[/] ID_CAP_MEDIALIB_AUDIO
[/] ID_CAP_MEDIALIB_PHOTO
[/] ID_CAP_MEDIALIB_PLAYBACK
[/] ID_CAP_SENSORS
[/] ID_CAP_WEBBROWSERCOMPONENT
6. Build your project by choose menu "BUILD > Build Solution".
7. Your result should be "1 succeeded" as below image, You're completed implement AdMob.
1. Connect your "WindowsPhone" to Windows Desktop / Laptop or Mac (Choose connect Windows), Please make sure your WP connect to Windows 10 by goto Run > All apps > Windows Phone SDK 8.0/8.1 > Windows Phone Developer Registration
2. Click [>] "Green Arrow" icon and on the right side leave 3 fields as [ Device ][ Debug ][ ARM ].
[ Device ][ Debug ][ ARM ]. << For print ads debug log in console
[ Device ][ Master ][ ARM ]. << For publish to store
[ Device ][ Release ][ ARM ]. << For test ads without log in console
3. If anything goes well you should see unity logo when app launch then Ads Interstitial will appear.
Unity project: http://sh.st/PCLxx
Visual Studio 2013 project: http://sh.st/PCLTP