Skip Navigation

Using the BBWebView library

BlackBerry Dynamics SDK
contains the BBWebView library that you can use to integrate the
WebView component with a
BlackBerry Dynamics
app. The BBWebView code is available under the com.blackberry.bbwebview package name. The library is located at sdk/libs/handheld/bb_webview in the SDK package.
The BBWebView library supports secure HTTP request interception for an internal network (URL loading, XML, and fetch HTTP requests), data leakage protection for cut, copy, and paste, page history navigation, and a secure cookies store. Additionally,  HTTP authentication (Basic, Digest, NTLM,
) is supported in the BBWebView library.
The BBWebview library also supports file downloading into the secure container and showing the downloaded text (txt), image (jpeg, jpg, png), audio (mp3), and video (mp4) files to the user. You can get the path to the BBWebView Download directory and access downloaded files using the BlackBerry Dynamics Secure Storage APIs ( You can also open the BBWebView library UI to show the content of the BBWebView directory to the user.
The BBWebView library contains the following APIs:
  • com.blackberry.bbwebview.BBWebChromeClient
  • com.blackberry.bbwebview.BBWebViewClient
  • com.blackberry.bbwebview.BBWebView
Note that BBWebView does not currently support:
  • File uploading into the secure container
  • URL schemes (mailto:, geo:, and so on)
  • Web worker (Service worker)
  • Pasting content from a
    BlackBerry Dynamics
    app to WebView using drag and drop
  • Resource caches
  • Secure database
  • Local storage (HTML5)
  • Session storage
  • AutoZSO
  • Secure drag-and-drop data movement between applications
To load files from the local assets folder, you must use the web-like URL format
rather than
. For example, the following code will load the index.html page from the assets folder in BBWebView:
// Initialize BBWebView instance BBWebView webView = ... // Provide url with file name which is located in your application's assets folder webView.loadUrl("");
This method is compatible with the Same-Origin policy and recommended by
. For more information, see WebViewAssetLoader.
The com.blackberry.bbwebview.WebClientObserver class is deprecated. For the required methods, you can extend BBWebViewClient, BBWebView, and BBWebChromeClient. For more information about the methods to override in BBWebViewClient,  BBWebView, or BBWebChromeClient, see the following Android developer resources:
BBWebView supports custom implementations of WebChromeClient and WebViewClient. To use this functionality, you must extend the BBWebChromeClient and BBWebViewClient classes.
The following sample demonstrates how to set custom implementations of BBWebChromeClient and BBWebViewClient for BBWebView:
webView = ... // Create BBWebView instance webView.setWebViewClient(new BBWebViewClient() { @Override public boolean shouldOverrideUrlLoading (WebView view, WebResourceRequest request) { if (request.getUrl().toString().startsWith("")) { 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"); } }); webView.setWebChromeClient(new BBWebChromeClient() { @Override public void onProgressChanged(WebView view, int newProgress) { Log.i("BBWebChromeClient", "onProgressChanged() progress = " + newProgress); } });