Android Pull-Tab Ad
The pull-tab is a new and unique ad format which is exclusively available through the MobileFuse SDK. Pull-tab ads are interactive rich-media units which peek in from the left side of your app. Users can initially interact with the ad by smoothly dragging it from the edge of the screen, or by tapping it to enter into a full-screen interstitial style experience.
Prerequisites
Display a pull-tab ad in your app
Displaying a pull-tab ad is a two-step process. First you should create and load your MobileFusePullTabAd
unit, then when you’re ready, call the showAd()
method to display the ad.
Create an pull-tab ad unit
The MobileFusePullTabAd
class provided by the MobileFuse SDK will handle the loading, display, and interactivity of the pull-tab creative. It is similar in implementation to MobileFuse interstitial ads.
Note: Ensure that critical sections of your app, for example buttons or text, do not sit within the left margin of the screen when displaying a pull-tab ad.
First, create a new MobileFusePullTabAd
unit and keep a reference to it within the Activity that you want to use it:
private MobileFusePullTabAd pullTabAd;
private void createPullTabAd() {
String placementId = "000000";
pullTabAd = new MobileFusePullTabAd(this, placementId);
// ...
}
Note: Ensure that the SDK has fully initialized before creating your ad units. You can use the onInitSuccess
callback as a good place to set up your ad units.
Next, add a listener - the listener will allow you to receive events from the ad unit. The pull-tab ad has some additional callbacks for pull-tab specific events.
pullTab.setListener(new MobileFusePullTabAd.Listener() {
@Override
public void onAdClosed() {
// The pull-tab ad has been dismissed and closed
}
@Override
public void onAdPulled() {
// The pull-tab ad has been pulled and expanded into a full-screen interstitial style view
}
@Override
public void onAdLoaded() {
// Called when the pull tab ad has been loaded and is ready to be displayed
}
@Override
public void onAdNotFilled() {
// The server responded with no fill (no ad available)
}
@Override
public void onAdRendered() {
// The pull-tab ad has been rendered and is displaying to the user
}
@Override
public void onAdClicked() {
// Called when the user clicks the pull-tab ad
}
@Override
public void onAdExpired() {
// This ad has expired and can no longer be displayed to the user - load a new ad
}
@Override
public void onAdError(AdError adError) {
// An error occurred, examine the adError argument to determine the problem
}
});
Finally, request that the ad is preloaded using the loadAd
method:
pullTabAd.loadAd();
Display the ad
Once the pull-tab ad has triggered the onAdLoaded
callback, you can then call showAd()
to start displaying the initial collapsed state of the ad:
Note: The pull-tab will render a tab in the left 10% of screen space. Be sure that when a pull-tab ad is displayed that you don’t place important UI components or buttons within this area. You may want to add padding to the left side of your activity to shift your UI away from the ad slightly. See the sample code for an example.
You can also use isLoaded()
to check whether the ad is ready to be displayed.