ServiceWorkerController
abstract class ServiceWorkerController
| kotlin.Any | |
| ↳ | android.webkit.ServiceWorkerController | 
Manages Service Workers used by WebView.
Example usage:
ServiceWorkerController swController = ServiceWorkerController.getInstance(); swController.setServiceWorkerClient(new ServiceWorkerClient() { @Override public WebResourceResponse shouldInterceptRequest(WebResourceRequest request) { // Capture request here and generate response or allow pass-through // by returning null. return null; } });
Summary
| Public constructors | |
|---|---|
| Public methods | |
|---|---|
| open static ServiceWorkerController | Returns the default ServiceWorkerController instance. | 
| abstract ServiceWorkerWebSettings | Gets the settings for all service workers. | 
| abstract Unit | setServiceWorkerClient(client: ServiceWorkerClient?)Sets the client to capture service worker related callbacks. | 
Public constructors
ServiceWorkerController
ServiceWorkerController()
Deprecated: This class should not be constructed by applications, use getInstance() instead to fetch the singleton instance.
Public methods
getInstance
open static fun getInstance(): ServiceWorkerController
Returns the default ServiceWorkerController instance. At present there is only one ServiceWorkerController instance for all WebView instances, however this restriction may be relaxed in the future.
| Return | |
|---|---|
| ServiceWorkerController | the default ServiceWorkerController instance This value cannot be null. | 
getServiceWorkerWebSettings
abstract fun getServiceWorkerWebSettings(): ServiceWorkerWebSettings
Gets the settings for all service workers.
| Return | |
|---|---|
| ServiceWorkerWebSettings | the current ServiceWorkerWebSettings This value cannot be null. | 
setServiceWorkerClient
abstract fun setServiceWorkerClient(client: ServiceWorkerClient?): Unit
Sets the client to capture service worker related callbacks. A ServiceWorkerClient should be set before any service workers are active, e.g. a safe place is before any WebView instances are created or pages loaded.
| Parameters | |
|---|---|
| client | ServiceWorkerClient?: This value may be null. | 
