• BlackBerry Dynamics
  • Runtime library for Android applications
  • 10.2.0.79
BBWebView Class Reference

Class for supporting access to private/corporate network resources through BlackBerry Dynamics SDK.

Inherits WebView.

Public Member Functions

 BBWebView (Context context)
 Construct a new WebView with a Context object. More...
 
 BBWebView (Context context, AttributeSet attrs)
 Construct a new WebView with layout parameters. More...
 
 BBWebView (Context context, AttributeSet attrs, int defStyleAttr)
 Construct a new WebView with layout parameters and a default style. More...
 
 BBWebView (Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
 Construct a new WebView with layout parameters and a default style. More...
 
void destroy ()
 Destroys the internal state of this WebView. More...
 
void setWebViewClient (WebViewClient client)
 Sets the WebViewClient that will receive various notifications and requests. More...
 
WebViewClient getWebViewClient ()
 Returns the internal BB SDK WebViewClient for supporting WebClientObserver class. More...
 
void setWebChromeClient (WebChromeClient client)
 Sets the chrome handler. More...
 
WebChromeClient getWebChromeClient ()
 Returns User's WebChromeClient for this BBWebView. More...
 
boolean onDragEvent (DragEvent event)
 Handles drag events sent by the system. More...
 
InputConnection onCreateInputConnection (EditorInfo outAttrs)
 Creates a new InputConnection for an InputMethod to interact with the WebView. More...
 
void loadUrl (String url, Map< String, String > additionalHttpHeaders)
 Loads the given URL with additional HTTP headers. More...
 
void loadUrl (String url)
 Loads the given URL. More...
 
void loadData (@NonNull String data, @Nullable String mimeType, @Nullable String encoding)
 Loads the given data into this WebView using a 'data' scheme URL. More...
 
void loadDataWithBaseURL (@Nullable String baseUrl, @NonNull String data, @Nullable String mimeType, @Nullable String encoding, @Nullable String historyUrl)
 Loads the given data into this WebView, using baseUrl as the base URL for the content. More...
 
void goBack ()
 Steps back in the history of this WebView. More...
 

Static Public Member Functions

static void showDownloadDirectory (Context context)
 Open the BBWebView Downloads user interface. More...
 
static String getDownloadDirectoryPath ()
 Get the BBWebView Downloads directory path. More...
 

Constructor & Destructor Documentation

◆ BBWebView() [1/4]

BBWebView ( Context  context)

Construct a new WebView with a Context object.

Parameters
contextA Context object used to access application assets.

◆ BBWebView() [2/4]

BBWebView ( Context  context,
AttributeSet  attrs 
)

Construct a new WebView with layout parameters.

Parameters
contextA Context object used to access application assets.
attrsAn AttributeSet passed to our parent.

◆ BBWebView() [3/4]

BBWebView ( Context  context,
AttributeSet  attrs,
int  defStyleAttr 
)

Construct a new WebView with layout parameters and a default style.

Parameters
contextA Context object used to access application assets.
attrsAn AttributeSet passed to our parent.
defStyleAttrAn attribute in the current theme that contains a reference to a style resource that supplies default values for the view. Can be 0 to not look for defaults.

◆ BBWebView() [4/4]

BBWebView ( Context  context,
AttributeSet  attrs,
int  defStyleAttr,
int  defStyleRes 
)

Construct a new WebView with layout parameters and a default style.

Parameters
contextA Context object used to access application assets.
attrsAn AttributeSet passed to our parent.
defStyleAttrAn attribute in the current theme that contains a reference to a style resource that supplies default values for the view. Can be 0 to not look for defaults.
defStyleResA resource identifier of a style resource that supplies default values for the view, used only if defStyleAttr is 0 or can not be found in the theme. Can be 0 to not look for defaults.

Member Function Documentation

◆ destroy()

void destroy ( )

Destroys the internal state of this WebView.

Refer to the equivalent method destroy() in the API Guide on the developer.android.com site.

◆ setWebViewClient()

void setWebViewClient ( WebViewClient  client)

Sets the WebViewClient that will receive various notifications and requests.

webView.setWebViewClient(new BBWebViewClient () {
@Override
public boolean shouldOverrideUrlLoading (WebView view, WebResourceRequest request) {
if (request.getUrl().toString().startsWith("https://example.com")) {
Log.i("BBWebViewClient", "shouldOverrideUrlLoading() forbidden loading url");
return true;
} else {
Log.i("BBWebViewClient", "shouldOverrideUrlLoading() continue loading url");
return false;
}
}
@Override
public void onPageFinished(WebView view, String url) {
Log.i("BBWebViewClient", "onPageFinished() url is loaded");
}
});

Refer to the equivalent method setWebViewClient in the API Guide on the developer.android.com site.

◆ getWebViewClient()

WebViewClient getWebViewClient ( )

Because WebClientObserver class is deprecated, it will be removed in the next release and this method will start returning User's WebViewClient.

Refer to the equivalent method getWebViewClient in the API Guide on the developer.android.com site.

◆ setWebChromeClient()

void setWebChromeClient ( WebChromeClient  client)

This is an implementation of WebChromeClient for use in handling JavaScript dialogs, favicons, titles, and the progress. This will replace the current handler.

Sets the chrome handler. This is an implementation of WebChromeClient for use in handling JavaScript dialogs, favicons, titles, and the progress. This will replace the current handler.

webView.setWebChromeClient(new BBWebChromeClient () {
@Override
public void onProgressChanged(WebView view, int newProgress) {
Log.i("BBWebChromeClient", "onProgressChanged() progress = " + newProgress);
}
});

Refer to the equivalent method setWebChromeClient in the API Guide on the developer.android.com site.

◆ getWebChromeClient()

WebChromeClient getWebChromeClient ( )

Refer to the equivalent method getWebChromeClient in the API Guide on the developer.android.com site.

◆ onDragEvent()

boolean onDragEvent ( DragEvent  event)

Handles drag events sent by the system.

Refer to the equivalent method onDragEvent in the API Guide on the developer.android.com site.

◆ onCreateInputConnection()

InputConnection onCreateInputConnection ( EditorInfo  outAttrs)

Creates a new InputConnection for an InputMethod to interact with the WebView.

Refer to the equivalent method onCreateInputConnection in the API Guide on the developer.android.com site.

◆ loadUrl() [1/2]

void loadUrl ( String  url,
Map< String, String >  additionalHttpHeaders 
)

Loads the given URL with additional HTTP headers, specified as a map from name to value.

Refer to the equivalent method loadUrl() in the API Guide on the developer.android.com site.

◆ loadUrl() [2/2]

void loadUrl ( String  url)

Loads the given URL.

Refer to the equivalent method loadUrl() in the API Guide on the developer.android.com site.

◆ loadData()

void loadData ( @NonNull String  data,
@Nullable String  mimeType,
@Nullable String  encoding 
)

Loads the given data into this WebView using a 'data' scheme URL.

Refer to the equivalent method loadData in the API Guide on the developer.android.com site.

◆ loadDataWithBaseURL()

void loadDataWithBaseURL ( @Nullable String  baseUrl,
@NonNull String  data,
@Nullable String  mimeType,
@Nullable String  encoding,
@Nullable String  historyUrl 
)

Loads the given data into this WebView, using baseUrl as the base URL for the content.

Refer to the equivalent method loadData() in the API Guide on the developer.android.com site.

◆ goBack()

void goBack ( )

Steps back in the history of this WebView.

Refer to the equivalent method goBack() in the API Guide on the developer.android.com site.

◆ showDownloadDirectory()

static void showDownloadDirectory ( Context  context)
static

Open BBWebView Downloads user interface.

Call this method to show the BBWebView Downloads user interface with a list of downloaded files in Download directory.

◆ getDownloadDirectoryPath()

static String getDownloadDirectoryPath ( )
static

Get the BBWebView Downloads directory path.

Call this method to get the path to the BBWebView Downloads directory in the secure file system. You can access downloaded files using the BlackBerry Dynamics Secure Storage APIs (com.good.gd.file).