Class InterstitialBuilder
java.lang.Object
com.appbrain.InterstitialBuilder
Convenience class used to configure and show interstitials. Its methods can be chained together,
e.g.:
InterstitialBuilder.create().setAdId(AdId.EXIT).setFinishOnExit(this).show(this)
-
Method Summary
Modifier and TypeMethodDescriptionstatic InterstitialBuildercreate()static InterstitialBuildergetAdId()booleanShows an interstitial at certain times.Loads an interstitial, which can then later be shown usingshow(Context)ormaybeShow(Context).Set theAdIdfor this interstitial, used to track different interstitials in your app.setAllowedToUseMediation(boolean allowedToUseMediation) Set to false to make sure this interstitial will not use mediation, even if mediation is enabled for its AdId.setAnalyticsString(String analyticsString) Set a custom string to pass on to the AppBrain servers for analytics purposes.setFinishOnExit(Activity activity) Finish this Activity when the interstitial is closed.setListener(InterstitialListener listener) Set a listener for open, close and click events of the interstitial.setOnDoneCallback(Runnable onDoneCallback) Set a callback for when the interstitial is done.setScreenType(AdOptions.ScreenType screenType) Set whether to show the interstitial and offerwall in full screen or as a dialog.booleanShows the interstitial if there is an internet connection.
-
Method Details
-
create
-
create
-
setAdId
Set theAdIdfor this interstitial, used to track different interstitials in your app. -
getAdId
- Returns:
- The current
AdIdset bysetAdId(AdId).
-
setListener
Set a listener for open, close and click events of the interstitial. -
getListener
- Returns:
- The current
InterstitialListenerset bysetListener(InterstitialListener).
-
setOnDoneCallback
Set a callback for when the interstitial is done. This is a convenient way to execute certain logic after the interstitial. The callback will be called either when the interstitial is closed, or when the interstitial is not opened (e.g. whenmaybeShow(Context)returns false). -
getOnDoneCallback
- Returns:
- The current callback set by
setOnDoneCallback(Runnable).
-
setScreenType
Set whether to show the interstitial and offerwall in full screen or as a dialog. The default is ScreenType.DIALOG. Note that a dialog is only used when opening the interstitial from an Activity that is not finishing. -
getScreenType
- Returns:
- The current
AdOptions.ScreenTypeset bysetScreenType(ScreenType).
-
setAnalyticsString
Set a custom string to pass on to the AppBrain servers for analytics purposes. -
getAnalyticsString
- Returns:
- The current analytics string set by
setAnalyticsString(String).
-
setFinishOnExit
Finish this Activity when the interstitial is closed. This sets theInterstitialListenerinternally, so can not be used in combination withsetListener(InterstitialListener). -
setAllowedToUseMediation
Set to false to make sure this interstitial will not use mediation, even if mediation is enabled for its AdId. Default value is true. -
preload
Loads an interstitial, which can then later be shown usingshow(Context)ormaybeShow(Context). Note that if you want to use AppBrain mediation, preload() must be called before showing. If you don't use mediation, preload() is optional. -
show
-
maybeShow
Shows an interstitial at certain times. Our algorithm determines the frequency optimized for the highest click through rate. The interstitial is only shown when there is an internet connection.- Parameters:
context- the currentContext- Returns:
- true if the interstitial was shown
-