Make some cash with your Cocos2D-X iOS games with Inner-active ads integration - Plunge Interactive

Make some cash with your Cocos2D-X iOS games with Inner-active ads integration

After adding data on Localytics (statistics) in  the previous post, now it’s time to earn money with iOS developing.

To do this we use a free multiplatform named InneractiveAd. I say multiplatform because it’s available in android, iOS and WPh7 devices. It’s too useful.

In first, we go to https://inneractive.jira.com/wiki/dashboard.action and login (or create an account if you don’t have one), after this download the InneractiveAd SDK and add  the files InneractiveAd.h and InneractiveAdSDK.a into your Xcode project.

To monetize your APP you have to create a new game and pick up the APP_KEY_ID (like in previous Localytics).

After this, we can  code. For add ads there are many methods:

1) Using DisplayAd method

In your delegate file (in my case AppController.mm, but may be AppDelegate[…].mm or something like this) add the next code line:

[InneractiveAd DisplayAd:@"APP_KEY_ID"
withType:IaAdType_Banner
withRoot:self.view
withReload:60]

There are three different types of Banners:  Text, Banner and Interstitial Add. Now we used simply Banner (“withType: IaAdType_Banner”).

2) Using InneractiveAd view

Maybe you want to show/hide your banner after create it. To do this I recommend this method (I do it ever). We need to create a parameter  named “banner” e.g. (do it in the same file that in step 1).

InneractiveAd *banner;

and after do something like:

banner = [[InneractiveAd alloc] initWithAppId:@"APP_KEY_ID"
withType:IaAdType_Banner
withReload:60];
[self.view addSubview:banner];

When you want to show or hide the banner simply do this:

banner.hidden = YES; // To hide
banner.hidden = NO; // To show

Simply.

3) Using network checking

If you want to checking the network connection of device before displayAd (it more efficient but not too much) you can do something like (do it in the same file that in step 1):

if  (! [InneractiveAd DisplayAd:@"APP_KEY_ID" withType:IaAdType_Banner  withRoot:self.view withReload:60 withParams:NO withDelegate:self])
{
	UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"This application is free but requires an internet connection."
                                                         message:@"Please configure your connectivity settings and retry."
                                                        delegate:self
                                               cancelButtonTitle:@"Exit"
                                               otherButtonTitles:nil] autorelease];
	[alert show];
}

This throws a system alert if device is not connected properly to network.

That’s it. Choose the one that you want and earn free money!!!

This site uses cookies to store information on your computer. Some cookies on this site are essential, and the site won't work as expected without them. Read more about them

ACCEPT