Multiple AppId support for IwGameAds.

Posted by

I have used IwGameAds for a while (I didn’t write the original code). One of the great things of using it with Marmalade  is that you can write your code once and ads appear everywhere you deploy it.

I use 2 ad providers, and I usually set up the platform as Android since IwGameAds only supported 1 appId per provider. This meant that whatever device is presenting the ads, it would always shows up as Android on the ad console. It also meant that such as ads for Android games would show up on Blackberry devices.

I made some small changes to the code to accommodate multiple appids per provider. You can get the version with my changes in my repo.

To add the extra appIds you can do it when creating the mediator:

Example 1:

// Create Inner-active ad party and add to the mediator

CIwGameAdsParty* party = new CIwGameAdsParty();

party->ApplicationID = “Default when it doesn’t match any of the others.”;

party->IOSAppID = “iOS AppId”;

party->BBAppID = “ONX based blackbery devices App Id.”;

party->AndroidAppID = “Android App Id.”;

party->WP8AppID = “Windows Phone 8 App Id.”;

party->Provider = CIwGameAds::InnerActive;

ad_mediator->addAdParty(party);

Example 2: Not all the appIds have to be provided it would just use the default when the others can’t be found:

CIwGameAdsParty* party = new CIwGameAdsParty();

party->ApplicationID = “Default when it doesn’t match any of the others.”;

party->IOSAppID = “iOS AppId”;

party->WP8AppID = “Windows Phone 8 App Id.”;

party->Provider = CIwGameAds::InnerActive;

ad_mediator->addAdParty(party);

Example 3: You can also use it without a mediator:

IW_GAME_ADS_VIEW->Init(“defaultAppId_Android”);

IW_GAME_ADS_VIEW->setAdProvider(CIwGameAds::InnerActive);

IW_GAME_ADS_VIEW->setIOSAppID(“appAppId_IOS”);

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.