public class InstreamVideoAdView extends RelativeLayout implements Ad
InstreamVideoAdView InstreamVideo = new InstreamVideoAdView(context, PLACEMENT_ID);
InstreamVideoView.setAdListener(new AbstractAdListener() {
public void onAdLoaded(Ad ad) {
}
});
InstreamVideoView.loadAd();
Modifier and Type | Class and Description |
---|---|
static interface |
InstreamVideoAdView.InstreamVideoLoadAdConfig
Marker interface for an object that represents an ad load config.
|
static interface |
InstreamVideoAdView.InstreamVideoLoadConfigBuilder
Builder that allows to configure an ad loading.
|
Ad.LoadAdConfig, Ad.LoadConfigBuilder
Constructor and Description |
---|
InstreamVideoAdView(Context context,
Bundle previousState) |
InstreamVideoAdView(Context context,
java.lang.String placementID,
AdSize adSize)
Constructs a InstreamVideoAdView given the context and the placement id
|
Modifier and Type | Method and Description |
---|---|
InstreamVideoAdView.InstreamVideoLoadConfigBuilder |
buildLoadAdConfig()
Returns
InstreamVideoAdView.InstreamVideoLoadConfigBuilder that allows to specify ad loading parameters. |
void |
destroy()
Destroys the ad control.
|
java.lang.String |
getPlacementId()
Get the placementId for this ad.
|
Bundle |
getSaveInstanceState() |
boolean |
isAdInvalidated()
Indicate whether the ad is still valid.
|
boolean |
isAdLoaded()
Tells whether an ad is loaded and ready to show
|
void |
loadAd()
Loads an ad.
|
void |
loadAd(InstreamVideoAdView.InstreamVideoLoadAdConfig loadAdConfig)
Loads an ad.
|
void |
loadAdFromBid(java.lang.String bidPayload)
Deprecated.
since 5.6
|
void |
setAdListener(InstreamVideoAdListener adListener)
Deprecated.
since 5.6, use
loadAd(InstreamVideoAdView.InstreamVideoLoadAdConfig) |
void |
setExtraHints(ExtraHints extraHints)
Deprecated.
|
boolean |
show()
Shows the Instream video ad
This method should only be called after
loadAd()
is called and the ad listener has been notified ad has loaded |
public InstreamVideoAdView(Context context, Bundle previousState)
context
- previousState
- public InstreamVideoAdView(Context context, java.lang.String placementID, AdSize adSize)
context
- Android contextplacementID
- id of ad placement eg. 12345_12345adSize
- the intended size of the placementpublic void loadAd()
Ad
This method always returns immediately. The ad is loaded asynchronously. The control's ad listener will be called when loading finishes or fails.
public void loadAd(InstreamVideoAdView.InstreamVideoLoadAdConfig loadAdConfig)
This method always returns immediately. The ad is loaded asynchronously. The control's ad listener will be called when loading finishes or fails.
InstreamVideoAdView ad = new InstreamVideoAdView(context, PLACEMENT_ID);
InstreamVideoLoadAdConfig loadAdConfig = ad.buildLoadAdConfig()
.withBid(bidPayload)
.withAdListener(adListener)
.build();
ad.loadAd(loadAdConfig);
@Deprecated public void loadAdFromBid(java.lang.String bidPayload)
Ad
loadAdFromBid
in interface Ad
bidPayload
- The payload supplied with the bidpublic boolean isAdInvalidated()
Ad
isAdInvalidated
in interface Ad
public boolean show()
loadAd()
is called and the ad listener has been notified ad has loaded@Deprecated public void setAdListener(InstreamVideoAdListener adListener)
loadAd(InstreamVideoAdView.InstreamVideoLoadAdConfig)
adListener
- @Deprecated public void setExtraHints(ExtraHints extraHints)
setExtraHints
in interface Ad
public void destroy()
Ad
This method should be called when the hosting activity of the ad control is destroyed.
public boolean isAdLoaded()
public java.lang.String getPlacementId()
Ad
getPlacementId
in interface Ad
public Bundle getSaveInstanceState()
public InstreamVideoAdView.InstreamVideoLoadConfigBuilder buildLoadAdConfig()
InstreamVideoAdView.InstreamVideoLoadConfigBuilder
that allows to specify ad loading parameters.
You should call loadAd(InstreamVideoLoadAdConfig)
after all parameters have been set.