Vserv’s new WP8 SDK offers offers a great opportunity to monetize your apps or games with only a small amount of additional effort. The Vserv.mobi WP8 SDK is designed to help you integrate Vserv Ads in your application and fast track your way to monetizing your WP8 applications.
Step 1. Register an account on vserv.mobi
If you already have a developer account at verv then skip to next step otherwise visit the following link to create a new account.
Step 2. Get your Zone ID from verv dashboard
Note down your ZoneID. This will be required later on when you use the WP8 SDK to request Ads. The default ZoneID will be available in your welcome email or you could visit https://admin.vserv.mobi/admin/affiliate-zones.php to get a list of all your zones.
Step 3. Get the vserv SDK for Windows Phone 8
The first step to integrating Vserv SDK in your WP8 application is to download our SDK package. The SDK package is available at the following link
We suggest that you unzip the SDK Zip file that you just downloaded into a temporary folder. You would find two folders in it, WP8V2SDK and SampleApp.
- Add a reference to vservWindowsPhone.dll to your project (Refer to this article if you get struck in adding a reference)
- Add the Images folder to your project from the vserv SDK folder
Alternatively the SDK can also be downloaded as NuGet package using the following command in the Nuget package manager (Refer to this article if you get struck in adding a reference).
Step 4. Add the following capabilities in your project
You also need to make sure that your project has the following capabilities
Step 5. Requesting vserv ads
Using vserv SDK you can either have banner ads or full page interstitial ads in your application. Before you request for Ads you need to make sure you initialize the VservAdControl. Ideally you should initialize this when defining it in your project before the calling constructor.
VservAdControl VMB = VservAdControl.Instance;
To request an interstitial you need to call the displayAd() method.
- displayAd() is a part of the VservAdControl (vservWindowsPhone library) which need to be initialized before requesting for an Ad.
- Optionally you can also set a timeout using the SetRequestTimeOut (timeout) method.
- Make sure you pass LayoutRoot, else the full-screen ad will be displayed in the small banner.
You can request for Banner Ads which auto refresh automatically in a specific View using RenderAd() method.
Firstly, add an AdGrid in your MainPage.xaml file
Then in the LayoutRoot loaded event handler add the code to render banner ads in your AdGrid1
Note: The RenderAd function takes two parameters
- First is the zoneID which you copied from your dashboard earlier
- Second is the name of the grid in which you wish to display ads
No Fill Callback
Sometimes vserv fails to deliver an ad. You would need to remove or hide the Banner Control when working with Banner Ads and other ad networks in its place.
- In the no fill event handler ad code to display ads from Google AdMob
- Or else request ads from Microsoft Pubcenter
void VACCallback_OnVservAdNoFill(object sender, EventArgs e)
Network Error Callback
At times when you request for an ad, there might not be any network available during the request, in which case the Vserv SDK calls the following method.
void VACCallback_OnVservAdNetworkError(object sender, EventArgs e)
Ad Close Callback
This is an essential callback which you need to implement. The Vserv Ads make use of the ApplicationBar to provide a native experience to the user, this is achieved by taking over your ApplicationBar. Thus, ideally you need to reinitialize your ApplicationBar in this callback. This is called when the user returns to your App from the Ad
void VACCallback_OnVservAdClosing(object sender, EventArgs e)
Get the full project source code here,