Package com.castlabs.android.adverts
Interface AdInterface
public interface AdInterface
Implementation of this interface provides access to Ad status.
It also allows to inject side-interpreted ads events that are used for
analytics and in app callbacks.
- Since:
- 3.2.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceListener for ad events. -
Method Summary
Modifier and TypeMethodDescriptionvoidInject the ad clicked side eventvoidInject the ad completed side eventvoidaddAdListener(AdInterface.Listener listener) Register the givenAdInterface.ListenervoidadError(Ad ad, CastlabsPlayerException exception) Inject the ad error side eventvoidadPaused()Inject the ad paused side eventvoidInject the ad resumed side eventvoidInject the ad skipped side eventvoidInject the ad started side event.voidadWillStart(Ad ad) Inject the ad will start side event.getAdApi()Get anAdApito issue custom operations to the ad providerlongGet the Ad position in microseconds.booleanCheck the Ad is currently playing.voidremoveAdListener(AdInterface.Listener listener) Remove the givenAdInterface.ListenervoidscheduleAd(AdRequest adRequest) Manually schedules anAdRequest.
-
Method Details
-
addAdListener
Register the givenAdInterface.Listener- Parameters:
listener- the listener
-
removeAdListener
Remove the givenAdInterface.Listener- Parameters:
listener- the listener
-
isPlaying
boolean isPlaying()Check the Ad is currently playing.- Returns:
- true if the Ad is currently playing otherwise false
-
getPosition
long getPosition()Get the Ad position in microseconds.- Returns:
- positionUs the position in microseconds
-
adWillStart
Inject the ad will start side event.- Parameters:
ad- The Ad object. Notice that in this level, some properties of the ad such asAd.titlemight be null.
-
adStarted
Inject the ad started side event.- Parameters:
ad- The ad
-
adPaused
void adPaused()Inject the ad paused side event -
adResumed
Inject the ad resumed side event- Parameters:
ad- The ad
-
adCompleted
void adCompleted()Inject the ad completed side event -
adClicked
Inject the ad clicked side event- Parameters:
clickthroughUrl- The clickthrough URL of the ad
-
adError
Inject the ad error side event- Parameters:
ad- The adexception- The error's exception
-
adSkipped
void adSkipped()Inject the ad skipped side event -
scheduleAd
Manually schedules anAdRequest. This can be called once playback is already started as long as the underlying AdLoader is compatible and manual ad schedulingis enabled. You can also useSdkConsts.AD_SCHEDULE_MANUAL. Note that if any other ads had been previously scheduled, such will be replaced by the new request.- Parameters:
adRequest- the AdRequest to schedule- Since:
- 4.2.24
-
getAdApi
Get anAdApito issue custom operations to the ad provider- Returns:
- the
AdApi
-