H5AdsWebViewClient

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


‫WebViewClient שמיירטת בקשות למודעות H5 ומטפלת בהן. כדי להשתמש בזה, צריך להגדיר את זה כלקוח של WebView שמכיל את אפליקציות האינטרנט שיבצעו בקשות להצגת מודעות H5.

חשוב: אי אפשר להשתמש בWebViewClient הזה לכמה WebView. כל WebView חדש שתומך במודעות H5 צריך להשתמש ב-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);
}

סיכום

‫constructors ציבוריים

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

Constructor for H5AdsWebViewClient.

פונקציות ציבוריות

Unit

מחיקה של כל המודעות שמנוהלות על ידי מודעות H5.

WebViewClient?

הפונקציה מחזירה את ה-WebViewClient של המשתמש שקיבל הרשאה.

Unit

מגדיר WebViewClient להעברת שיטות שלא מטופלות על ידי H5AdsWebViewClient.

פונקציות מוגנות

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

‫constructors ציבוריים

H5AdsWebViewClient

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

Constructor for H5AdsWebViewClient.

פרמטרים
context: Context!

הקשר של פעילות או אפליקציה.

webView: WebView!

WebView שישויך ל H5AdsWebViewClient הזה. צריך להפעיל את JavaScript ב-WebView.

פונקציות ציבוריות

clearAdObjects

fun clearAdObjects(): Unit

מחיקה של כל המודעות שמנוהלות על ידי מודעות H5.

הערה: לשיטה הזו אין השפעה על מודעות שנוצרו על ידי AdMob API שאינו H5, כמו com.google.android.gms.ads.interstitial.InterstitialAd ו-com.google.android.gms.ads.rewarded.RewardedAd.

getDelegateWebViewClient

fun getDelegateWebViewClient(): WebViewClient?

הפונקציה מחזירה את ה-WebViewClient של המשתמש שקיבל הרשאה.

setDelegateWebViewClient

fun setDelegateWebViewClient(delegate: WebViewClient?): Unit

מגדיר WebViewClient להעברת שיטות שלא מטופלות על ידי H5AdsWebViewClient.

פונקציות מוגנות

getDelegate

protected fun getDelegate(): WebViewClient!