Unified Platform – Adobe Native Extension SDK 10 Advanced Features

SDK 10 is the launch of our unified platform with Fyber and unifies the core features of Heyzap and Fyber into a single stack. With the unified platform, you’ll be able to use our newest features while also gaining access to both dashboards.

From an integration perspective, the only major change is the replacement of network SDKs with adapter bundles.

Manual Fetching

In some scenarios, you may wish to disable automatic fetching of the ad from the ad server. Reasons for manual fetching could be if you are putting Heyzap into a waterfall with other ad networks, using a mediation network, or are worried about the performance or bandwidth impact of Heyzap ads.

To put the Heyzap SDK into manual mode, start the SDK (as shown in Step 1) with the following flag:

HeyzapAds.getInstance().start("<PUBLISHER ID>", HeyzapAds.FLAG_DISABLE_AUTOMATIC_FETCH);

Then when fetching an ad, do the following:

InterstitialAd.getInstance().fetch();

After succesfully fetching an ad, you will receive an HeyzapEvent.IS_AVAILABLE callback (see below), whereby it is safe to show an ad:

if (InterstitialAd.getInstance().isAvailable()) {
     InterstitialAd.getInstance().show();
}

Important: It is highly recommended to fetch as far in advance of showing an ad as possible. For example, you may want to fetch an ad when a level starts, or after a previous ad has been shown.

Interstitial Callbacks

There are different events that can be fired in the lifecycle of an interstitial ad. These events are part of the HeyzapEvent class found in the ANE. The following events are fired.

// Did Show: When an interestitial ad is shown.
HeyzapEvent.DID_SHOW

// Did Hide: When an interestitial ad is hidden (also called after a click)
HeyzapEvent.DID_HIDE

// Did Fail: When an ad cannot be shown (usually because of no internet connection)
HeyzapEvent.DID_FAIL

// Is Available: Ad has successfully pre-fetched and can be shown
HeyzapEvent.IS_AVAILABLE

// Fetch Failed: When a pre-fetch was attempted but no ad was returned.
HeyzapEvent.FETCH_FAILED

// Audio Started: When the ad being shown will be using audio. Any background music should be muted.
HeyzapEvent.ON_AUDIO_STARTED

// Audio Finished: When the ad being shown no longer requires audio. Any background music can be resumed.
HeyzapEvent.ON_AUDIO_FINISHED

An example is shown below on how one might listen in for a particular event:

import com.heyzap.sdk.ads.HeyzapAds;
import com.heyzap.sdk.ads.InterstitialAd;
import com.heyzap.sdk.HeyzapEvent;

InterstitialAd.getInstance().addEventListener(HeyzapEvent.DID_SHOW, function(event:Event=null){
  // Do something here
  return null;
});

You may also listen for the same events on IncentivizedAd.

Incentivized Callbacks

For incentivized ads, there are two extra OnStatusListener callbacks available, in addition to the callbacks available for interstitials (see above). These events are also part of the HeyzapEvent class found in the ANE.

// Incentivized ad is completed
HeyzapEvent.IS_COMPLETED

// Incentivized ad was not completed
HeyzapEvent.IS_INCOMPLETE

An example is shown below on how one might listen in for a particular event:

import com.heyzap.sdk.ads.HeyzapAds;
import com.heyzap.sdk.ads.IncentivizedAd;
import com.heyzap.sdk.HeyzapEvent;

IncentivizedAd.getInstance().addEventListener(HeyzapEvent.IS_COMPLETED, 
    function(event:Event=null){
       // Give the user their reward!
       return null;
    });

Banner Ad Callbacks

For banner ads, you will receive the following OnStatusListener callbacks. There are three different events that can be fired in the lifecycle of an banner ad. These events are part of the HeyzapEvent class found in the ANE.

// Did Click: When a Banner ad is clicked
HeyzapEvent.DID_CLICK

// On Loaded: When an Banner ad is loaded and ready to be shown
HeyzapEvent.ON_LOADED

// On Error: When a banner ad cannot be shown (usually because of no internet connection)
HeyzapEvent.ON_ERROR

An example is shown below on how one might listen in for a particular event:

import com.heyzap.sdk.ads.HeyzapAds;
import com.heyzap.sdk.ads.BannerAd;
import com.heyzap.sdk.HeyzapEvent;

BannerAd.getInstance().addEventListener(HeyzapEvent.ON_ERROR, 
    function(event:Event=null) {
       // Do something here
       return null;
    });

Banner Ad Dimensions

The dimensions method can be used to get a Rectangle object which will contain the size and position of the currently displayed banner ad. The object will contain empty values if a banner ad is not displayed.

import com.heyzap.sdk.ads.HeyzapAds;
import com.heyzap.sdk.ads.BannerAd;
import flash.geom.Rectangle;

var bannerDimensions:Rectangle = BannerAd.getInstance().dimensions();
trace("Banner Ad Dimensions: width=" + bannerDimensions.width + " height=" + bannerDimensions.height);