H5AdsRequestHandler

public final class H5AdsRequestHandler


Handles H5 ad requests.

If using a android.webkit.WebView, use H5AdsWebViewClient instead of this class.

Otherwise, if using an alternative web view, create an instance of this class, and pass every web request to {@link #handleH5AdsRequest(String)}.

Summary

Public constructors

Constructs a H5AdsRequestHandler.

Public methods

final void

Destroys all ads being managed by H5 ads.

final boolean

Attempts to handle an H5 ads request.

final boolean

Returns true if request is for H5 ads, false otherwise.

Public constructors

H5AdsRequestHandler

public H5AdsRequestHandler(@NonNull OnH5AdsEventListener onH5AdsEventListener)

Constructs a H5AdsRequestHandler.

Parameters
@NonNull OnH5AdsEventListener onH5AdsEventListener

The OnH5AdsEventListener that will receive h5 events.

Public methods

clearAdObjects

public final void clearAdObjects()

Destroys all ads being managed by H5 ads.

Note: This method has no effect on any ads instantiated by non-H5 APIs, such as com.google.android.libraries.ads.mobile.sdk.interstitial.InterstitialAd and com.google.android.libraries.ads.mobile.sdk.rewarded.RewardedAd.

handleH5AdsRequest

@CanIgnoreReturnValue
public final boolean handleH5AdsRequest(@NonNull String url)

Attempts to handle an H5 ads request.

Returns
boolean

true if the request was an H5 ads request, false otherwise.

shouldInterceptRequest

public final boolean shouldInterceptRequest(@NonNull String url)

Returns true if request is for H5 ads, false otherwise.