ServiceWorkerWebSettingsCompat
abstract class ServiceWorkerWebSettingsCompat
kotlin.Any | |
↳ | androidx.webkit.ServiceWorkerWebSettingsCompat |
Manages settings state for all Service Workers. These settings are not tied to the lifetime of any WebView because service workers can outlive WebView instances. The settings are similar to WebSettings
but only settings relevant to Service Workers are supported.
Summary
Public methods | |
---|---|
abstract Boolean |
Gets whether Service Workers support content URL access. |
abstract Boolean |
Gets whether Service Workers support file access. |
abstract Boolean |
Gets whether Service Workers are prohibited from loading any resources from the network. |
abstract Int |
Gets the current setting for overriding the cache mode. |
abstract Unit |
setAllowContentAccess(allow: Boolean) Enables or disables content URL access from Service Workers. |
abstract Unit |
setAllowFileAccess(allow: Boolean) Enables or disables file access within Service Workers. |
abstract Unit |
setBlockNetworkLoads(flag: Boolean) Sets whether Service Workers should not load resources from the network. |
abstract Unit |
setCacheMode(mode: Int) Overrides the way the cache is used. |
Public methods
getAllowContentAccess
abstract fun getAllowContentAccess(): Boolean
Gets whether Service Workers support content URL access.
This method should only be called if WebViewFeature#isFeatureSupported(String)
returns true for WebViewFeature#SERVICE_WORKER_CONTENT_ACCESS
.
See Also
getAllowFileAccess
abstract fun getAllowFileAccess(): Boolean
Gets whether Service Workers support file access.
This method should only be called if WebViewFeature#isFeatureSupported(String)
returns true for WebViewFeature#SERVICE_WORKER_FILE_ACCESS
.
See Also
getBlockNetworkLoads
abstract fun getBlockNetworkLoads(): Boolean
Gets whether Service Workers are prohibited from loading any resources from the network.
This method should only be called if WebViewFeature#isFeatureSupported(String)
returns true for WebViewFeature#SERVICE_WORKER_BLOCK_NETWORK_LOADS
.
Return | |
---|---|
Boolean |
true if the Service Workers are not allowed to load any resources from the network |
See Also
getCacheMode
abstract fun getCacheMode(): Int
Gets the current setting for overriding the cache mode.
This method should only be called if WebViewFeature#isFeatureSupported(String)
returns true for WebViewFeature#SERVICE_WORKER_CACHE_MODE
.
Return | |
---|---|
Int |
the current setting for overriding the cache mode |
See Also
setAllowContentAccess
abstract fun setAllowContentAccess(allow: Boolean): Unit
Enables or disables content URL access from Service Workers.
This method should only be called if WebViewFeature#isFeatureSupported(String)
returns true for WebViewFeature#SERVICE_WORKER_CONTENT_ACCESS
.
setAllowFileAccess
abstract fun setAllowFileAccess(allow: Boolean): Unit
Enables or disables file access within Service Workers.
This method should only be called if WebViewFeature#isFeatureSupported(String)
returns true for WebViewFeature#SERVICE_WORKER_FILE_ACCESS
.
setBlockNetworkLoads
abstract fun setBlockNetworkLoads(flag: Boolean): Unit
Sets whether Service Workers should not load resources from the network.
This method should only be called if WebViewFeature#isFeatureSupported(String)
returns true for WebViewFeature#SERVICE_WORKER_BLOCK_NETWORK_LOADS
.
Parameters | |
---|---|
flag |
Boolean: true means block network loads by the Service Workers |
setCacheMode
abstract fun setCacheMode(mode: Int): Unit
Overrides the way the cache is used.
This method should only be called if WebViewFeature#isFeatureSupported(String)
returns true for WebViewFeature#SERVICE_WORKER_CACHE_MODE
.
Parameters | |
---|---|
mode |
Int: the mode to use. One of WebSettings#LOAD_DEFAULT , WebSettings#LOAD_CACHE_ELSE_NETWORK , WebSettings#LOAD_NO_CACHE or WebSettings#LOAD_CACHE_ONLY . The default value is WebSettings#LOAD_DEFAULT . |
See Also