Using the OkHttp HTTP framework
BlackBerry Dynamics SDK for Androidsupports the OkHttp API to provide efficient HTTP request handling. The SDK provides the following classes for OkHttp support:
- BBCustomInterceptor: This class provides support for the OkHttp HTTP framework by using an interceptor that you can add when creating an OkHttpClient object. This interceptor directs HTTP request through theBlackBerry Dynamicssecure communications system. For more information, see the BBCustomInterceptor Class Reference.
- BBCookieJar: This class provides cookie support for the OkHttp HTTP framework with the BBCustomInterceptor class. With this class, your apps can access cookies that are managed by theBlackBerry DynamicsRuntime through the BBCookieJar API. Cookies are always stored in the secure container. For more information, see the BBCookieJar Class Reference.
BlackBerry Dynamicsuses OkHttp version 4.9.1.
The following table outlines limitations for OkHttp as of this release:
Caching is not supported in this release.
Proxy servers are supported, but there is no API to set a proxy. It will work if proxies are set in
UEM, either using a PAC file or manually. If proxy authentication is required, this will be done automatically as is the case for the existing HttpClient API. Per-user credentials for a
UEMconfigured proxy are not currently supported as the 407 responses from the proxy will not be returned.
For more information, see Sending BlackBerry Dynamics app data through an HTTP proxy in the
BlackBerry UEMadministration guide.
Timeouts in OkHttp are separated into connection timeouts, read timeouts, and write timeouts.
BlackBerry DynamicsOkHttp only supports connection timeouts, and it is not currently possible to change the timeout value.
It is not currently possible to disable HTTPS host/peer certificate verification, or to enforce pinned certificates.