This RoboPod requires you to download and add the native 3rd party framework manually:
- Download the SDK for iOS from https://developers.heyzap.com
- Put the
HeyzapAds.framework
folder in your iOS project'slibs/
folder - Add the following to your
robovm.xml
<config>
...
<frameworkPaths>
<path>libs</path>
</frameworkPaths>
<frameworks>
<framework>HeyzapAds</framework>
</frameworks>
</config>
Add the following dependency to your build.gradle
:
dependencies {
... other dependencies ...
compile "org.robovm:robopods-heyzap-ios:$robopodsVersion"
}
Add the following dependency to your pom.xml
:
<dependency>
<groupId>org.robovm</groupId>
<artifactId>robopods-heyzap-ios</artifactId>
<version>${robopods.version}</version>
</dependency>
Before you can display any ads, you have to setup the SDK.
Add the following code to your application's entry point, typically didFinishLaunching()
in your app delegate.
HeyzapAds.start("PUBLISHER_ID");
Change the PUBLISHER_ID
with the id that you can find in your Heyzap dashboard.
When setting up Heyzap it's very helpful to get logs.
Add the following code before starting Heyzap:
HeyzapAds.setDebug(true);
HeyzapAds.setDebugLevel(HZDebugLevel.Verbose); // Adjust level to your needs.
...
HeyzapAds.start("PUBLISHER_ID");
Note: Don't forget to disable debug logging when you release your app!
- Make sure you have setup an app in your Heyzap dashboard
and specified the correct
PUBLISHER_ID
. - Check your logs for any errors, like network failures.
Heyzap is an ad mediation network, so we should add as many different ad providers as possible.
You can use all ad networks that you setup in the Heyzap mediation dashboard.
Use the following link to download all SDKs of ad networks you want to integrate:
Copy the .framework
or .a
files into your project libs/
folder.
Also add an entry for each framework and library in your robovm.xml
.
<frameworks>
<framework>UnityAds</framework>
</frameworks>
<libs>
<lib>libs/libAppLovinSdk.a</lib>
</libs>
You can use the Mediation Test Suite to check if all networks are correctly setup.
To use the Mediation Test Suite, simply call presentMediationDebugViewController()
after you start the SDK and have setup a root view controller:
HeyzapAds.start("PUBLISHER_ID");
HeyzapAds.presentMediationDebugViewController();
- Make sure you have setup different ad networks app in your Heyzap dashboard.
- Check your logs for any errors, like network failures.
- Load and display advertisements in your app: Link TODO
- Read the official Heyzap iOS documentation: Link
Load and display ads.
Interstitial ads are automatically loaded by Heyzap, you only have to show them when needed:
HZInterstitialAd.show();
Video ads need to be fetched before showing them:
HZVideoAd.fetch();
When you are ready to show them use the following code:
HZVideoAd.show();
Rewarded video ads need to be fetched before showing them:
HZIncentivizedAd.fetch();
When you are ready to show them use the following code:
HZIncentivizedAd.show();
To add banner ads to your app you first have to create banner options. You can specify the presenting view controller and banner sizes for various ad providers along with other options:
HZBannerAdOptions options = new HZBannerAdOptions();
Now you just need to place the banner in your view controller:
HZBannerAd.placeBannerInView(viewController.getView(),
HZBannerPosition.Bottom,
options,
banner -> {
// SUCCESS
},
error -> {
// ERROR
});
Specify the view controllers view, the banner position, the options you created earlier and callbacks for success and error.
You can store and modify the HZBannerAd
instance that you get in the success callback.
Add the code for ads to your app and run the app. If you setup everything correctly you should see ads in your app after a little loading time.