H5AdsWebViewClient

@RequiresApi(api = VERSION_CODES.LOLLIPOP)
class H5AdsWebViewClient : WebViewClient


H5 広告リクエストをインターセプトして処理する WebViewClient。これを使用するには、H5 広告リクエストを行うウェブアプリを含む WebView のクライアントとして設定します。

重要: この WebViewClient は複数の WebView に使用できません。H5 広告をサポートする新しい WebView は、新しい H5AdsWebViewClient を使用する必要があります。

コードの例:

public void onCreate(Bundle savedInstanceState) {
  ...

  // Initialize early to reduce latency on the session's first ad request.
  MobileAds.initialize(this);

  WebView myWebView = findViewById(R.id.my_webview);

  // JavaScript must be enabled.
  WebSettings settings = myWebView.getSettings();
  settings.setJavaScriptEnabled(true);

  H5AdsWebViewClient h5Client = new H5AdsWebViewClient(this, myWebView);

  // (Optional) any existing WebViewClient
  WebViewClient myClient = ...;
  h5Client.setDelegateWebViewClient(myClient);

  webView.setWebViewClient(h5Client);
}

概要

パブリック コンストラクタ

H5AdsWebViewClient(context: Context!, webView: WebView!)

H5AdsWebViewClient のコンストラクタ。

パブリック関数

Unit

H5 広告で管理されているすべての広告を破棄します。

WebViewClient?

委任された WebViewClient を取得します。

Unit

H5AdsWebViewClient で処理されないメソッドを委任する WebViewClient を設定します。

プロテクト関数

WebViewClient!

継承される関数

android.webkit.WebViewClient から
Unit
Unit
Unit
Unit
Unit
Unit
onPageStarted(p: WebView!, p1: String!, p2: Bitmap!)
Unit
Unit
Unit
onReceivedHttpAuthRequest(
    p: WebView!,
    p1: HttpAuthHandler!,
    p2: String!,
    p3: String!
)
Unit
onReceivedHttpError(
    p: WebView!,
    p1: WebResourceRequest!,
    p2: WebResourceResponse!
)
Unit
onReceivedLoginRequest(p: WebView!, p1: String!, p2: String!, p3: String!)
Unit
Boolean
Unit
onSafeBrowsingHit(
    p: WebView!,
    p1: WebResourceRequest!,
    p2: Int,
    p3: SafeBrowsingResponse!
)
Unit
onScaleChanged(p: WebView!, p1: Float, p2: Float)
Unit

この関数は非推奨になりました。

Unit
WebResourceResponse!
Boolean
Boolean

パブリック コンストラクタ

H5AdsWebViewClient

H5AdsWebViewClient(context: Context!, webView: WebView!)

H5AdsWebViewClient のコンストラクタ。

パラメータ
context: Context!

アクティビティまたはアプリのコンテキスト。

webView: WebView!

この H5AdsWebViewClient に関連付けられる WebView。WebView で JavaScript を有効にする必要があります。

パブリック関数

clearAdObjects

fun clearAdObjects(): Unit

H5 広告で管理されているすべての広告を破棄します。

注: このメソッドは、com.google.android.gms.ads.interstitial.InterstitialAd や com.google.android.gms.ads.rewarded.RewardedAd などの H5 以外の AdMob API によって作成された広告には影響しません。

getDelegateWebViewClient

fun getDelegateWebViewClient(): WebViewClient?

委任された WebViewClient を取得します。

setDelegateWebViewClient

fun setDelegateWebViewClient(delegate: WebViewClient?): Unit

H5AdsWebViewClient で処理されないメソッドを委任する WebViewClient を設定します。

プロテクト関数

getDelegate

protected fun getDelegate(): WebViewClient!