How to integrate heyzap Interstitial Ads in Android application!!

June 22, 2013 | Rishabh Agrawal | General

Android SDK – Ads

Step 1: Enable ads

Make a call to HeyzapAds.start(this) as early in your game’s initialization code as you can, preferably directly after your call to HeyzapLib.load(). That will give our SDK time to prefetch the ads, and ensure your users never see a loading spinner.
import com.heyzap.sdk.ads.HeyzapAds;

HeyzapLib.load(this, false);
HeyzapAds.start(this);

Step 2: Edit your game’s AndroidManifest.xml

For the ads sdk, we require the INTERNET and ACCESS_NETWORK_STATE permission. This lets us know if the user is connected to the internet, as we only want to show ads to users who can download games.
To add these permissions to your manifest file, add the following lines anywhere between the <manifest> and </manifest> tags in your AndroidManifest.xml.
<uses-permission android:name=”android.permission.INTERNET”></uses-permission>
<uses-permission android:name=”android.permission.ACCESS_NETWORK_STATE”></uses-permission>
In addition, we have a BroadcastReceiver that lets us know when users install a game so we can credit your account with the install.
To enable the broadcast receiver, add the following lines anywhere between the <application> and </application> tags in your AndroiManifest.xml.
<receiver android:name=”com.heyzap.sdk.PackageAddedReceiver”>
<intent-filter>
<data android:scheme=”package”/>
<action android:name=”android.intent.action.PACKAGE_ADDED”/>
</intent-filter>
</receiver>

Step 3: Show an ad Interstitials

Whenever you want to show an interstitial ad, call:
import com.heyzap.sdk.ads.InterstitialOverlay;

InterstitialOverlay.display(this);
where this is an Activity class (important!)
If you wish to hide the ad, call
InterstitialOverlay.dismiss();
If an in-game ad is available or loading, this call will show a loading dialog or an ad dialog. If no ad is available, nothing will be displayed. In either case this call will return immediately, allowing you to conduct other work in the background (such as loading the next level).
We recommend this call be made after a player completes a level or where there is a natural break in play.

Testing

The game displaying the ads must be in Heyzap’s databases or the ad will not work.
To ensure your game is in the Heyzap database, search by Android package name on the Developer Dashboard. (TIP: You can claim your games to see stats on your integration.) If your game does not appear, you need to manually add it to the Heyzap database here before testing.

Post By: Nishant Anindya

 


THE AUTHORRishabh Agrawal

Rishabh Agrawal is the founder of Creatiosoft, a company focused on creating high-quality software for the iGaming industry, specialising in poker and card games. With years of experience, Rishabh is dedicated to delivering engaging and user-friendly gaming experiences. Through this blog, he shares his passion and insights to help readers understand the latest trends and advancements in iGaming.

Recent Posts

The Future of Mobile Gaming: What to Expect in the Next 5 Years

Over the years, mobile gaming has seen amazing development and innovation utilized by the game development company in India. It…
06 Jun 2023 Rishabh Agrawal

How Do I Get Started With NFT Gaming?

The popularity of the NFT game has created a different fan base. There was a time when games were a…
18 Jul 2022 Rishabh Agrawal

What Are The Top Trends in NFT Marketplace 2022?

The NFTs are the new engaging and revolutionary technology across the globe. Though, these non-fungible tokens appeared for the first…
09 Jun 2022 Rishabh Agrawal