ConsoliAds In-app Campaigns Integration (for v.10.x.x & above)
Before you proceed to implement ConsoliAds in-app campaigns, following are the required prerequisites:
- ConsoliAds mediation SDK should be integrated in your project as mentioned in Developer Docs
- The mediation SDK should be initialized
- To successfully implement InApp purchase in your project, you need to create a campaign.
Here is the link on how to create a campaign: https://consoliads.com//kb/cross-promotion-campaign.
Show In-app Ad
- In-app ads are supported for all the available ad formats i.e. Interstitial, video, rewarded video, banner, native and icon
- Since the ad showing mechanism is already the same as used in the mediation SDK (such as ConsoliAds.Instance.ShowInterstitial()), no extra lines of code are required to show in-app ads.
- On the availability of in-app campaigns, the above mentioned Show method would display in-app ad and exhibit the functionality automatically
Implement callbacks for In-app Campaigns:
To receive the events for inApp purchases please set the delegate as follows:
[[ConsoliAdsMediation sharedInstance] setInAppAdDelegate:self];
self: reference of the ViewController
Following are the available events:
- (void)onInAppPurchaseFailed:(CAInAppError*)error // callback with error object in case the in-app purchase fails
- (void)onInAppPurchaseSuccess:(CAInAppDetails*)product // callback with the product details object in case the in-app purchase succeeds
Ready to Code for iOS
To enable ConsoliAds in-app campaigns:
- Download ‘libConsoliAdsInApp.a’ from the Documentation->Download ConsoliAds->iOS section of the ConsoliAds dashboard
- Copy the above file in the root folder of your project.
- In your project settings select “General” tab:
- In the “General” tab go to “Frameworks, Libraries and Embedded Content” and add the “StoreKit.framework”.
- In the project settings select the “Signing & Capabilities” tab:
- Click on “+ Capability”.
- Search and add “In-App Purchase”
** Your project is ready to implement ConsoliAds in-app purchase campaigns **
Ready to Code for Android
To enable ConsoliAds in-app campaigns:
- Download ‘consoliadsinapp.aar’ from the Documentation->Download ConsoliAds->Android section of the ConsoliAds dashboard
- Copy the above file in the libs folder of your project.
- In your project add following dependencies in build.gradle file:
implementation "com.android.billingclient:billing:3.0.0"
implementation(name: 'consoliadsinapp', ext: 'aar')
** Your project is ready to implement ConsoliAds in-app purchase campaigns **
Implement callbacks for In-app Campaigns:
To receive the events for inApp purchases please set the listeners as follows:
ConsoliAds.Instance().setConsoliAdsInAppListener(ConsoliAdsInAppListener consoliAdsInAppListener);
Following are the available events:
- void onInAppFailureEvent(CAInAppError caInAppError);
// callback with error object in case the in-app purchase fails
- void onInAppSuccessEvent(CAInAppDetails caInAppDetails);
// callback with the product details object in case the in-app purchase succeeds
Ready to Code for Unity
To enable ConsoliAds in-app campaigns:
- Download ‘consoliads-InApp.unitypackage’ from the Documentation->Download ConsoliAds->Unity section of the ConsoliAds dashboard
- Double click the above file to import the InApp purchase package in your unity project
** Your project is ready to implement ConsoliAds in-app purchase campaigns **
Additional Steps for Unity IOS:
To enable InAppPurchase Ads you have to do the following steps in xcode project:
- In your project settings select “General” tab:
- In the “General” tab go to “Frameworks, Libraries and Embedded Content” and add the “StoreKit.framework”.
- In the project settings select the “Signing & Capabilities” tab:
- Click on “+ Capability”.
- Search and add “In-App Purchase”