public class

AirshipWebViewClient

extends WebViewClient
java.lang.Object
   ↳ android.webkit.WebViewClient
     ↳ com.urbanairship.webkit.AirshipWebViewClient
Known Direct Subclasses

Class Overview

A web view client that enables the Airship Native Bridge on allowed URLs.

Summary

[Expand]
Inherited Constants
From class android.webkit.WebViewClient
Public Constructors
AirshipWebViewClient()
Default constructor.
AirshipWebViewClient(ActionRunRequestFactory requestFactory)
Public Methods
void addAuthRequestCredentials(String expectedAuthHost, String username, String password)
Adds auth request credentials for a host.
void onLoadResource(WebView webView, String url)
void onPageFinished(WebView view, String url)
void onPageStarted(WebView view, String url, Bitmap favicon)
void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error)
void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm)
void removeAuthRequestCredentials(String expectedAuthHost)
Removes auth request credentials for a host.
void setActionCompletionCallback(ActionCompletionCallback actionCompletionCallback)
Sets the action completion callback to be invoked whenever an Action is finished running from the web view.
WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest request)
Intercepts the favicon request and returns blank favicon
WebResourceResponse shouldInterceptRequest(WebView webView, String url)
Intercepts the favicon request and returns a blank favicon
boolean shouldOverrideUrlLoading(WebView webView, String url)
Protected Methods
boolean isAllowed(String url)
Checks if the URL is allowed.
void onClose(WebView webView)
Called when UAirship.close() is triggered from the Airship Javascript interface.
[Expand]
Inherited Methods
From class android.webkit.WebViewClient
From class java.lang.Object

Public Constructors

public AirshipWebViewClient ()

Default constructor.

public AirshipWebViewClient (ActionRunRequestFactory requestFactory)

Public Methods

public void addAuthRequestCredentials (String expectedAuthHost, String username, String password)

Adds auth request credentials for a host.

Parameters
expectedAuthHost The expected host.
username The auth user.
password The auth password.

public void onLoadResource (WebView webView, String url)

public void onPageFinished (WebView view, String url)

public void onPageStarted (WebView view, String url, Bitmap favicon)

public void onReceivedError (WebView view, WebResourceRequest request, WebResourceError error)

public void onReceivedHttpAuthRequest (WebView view, HttpAuthHandler handler, String host, String realm)

public void removeAuthRequestCredentials (String expectedAuthHost)

Removes auth request credentials for a host.

Parameters
expectedAuthHost The expected host.

public void setActionCompletionCallback (ActionCompletionCallback actionCompletionCallback)

Sets the action completion callback to be invoked whenever an Action is finished running from the web view.

Parameters
actionCompletionCallback The completion callback.

public WebResourceResponse shouldInterceptRequest (WebView webView, WebResourceRequest request)

Intercepts the favicon request and returns blank favicon

Parameters
webView The web view.
request The WebResourceRequest being loaded.
Returns
  • The blank favicon image embedded in a WebResourceResponse or null if the url does not contain a favicon.

public WebResourceResponse shouldInterceptRequest (WebView webView, String url)

Intercepts the favicon request and returns a blank favicon

Parameters
webView The web view.
url The url being loaded.
Returns
  • The blank favicon image embedded in a WebResourceResponse or null if the url does not contain a favicon.

public boolean shouldOverrideUrlLoading (WebView webView, String url)

Protected Methods

protected boolean isAllowed (String url)

Checks if the URL is allowed.

Parameters
url The URL being loaded.
Returns
  • true if the URL is allowed, otherwise false.

protected void onClose (WebView webView)

Called when UAirship.close() is triggered from the Airship Javascript interface. The default behavior simulates a back key press.

Parameters
webView The web view.