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 Unit

Sets whether Service Workers should not load resources from the network, see WebSettings#setBlockNetworkLoads.

abstract Boolean

Gets whether Service Workers are prohibited from loading any resources from the network.

abstract Unit

Enables or disables content URL access from Service Workers, see WebSettings#setAllowContentAccess.

abstract Boolean

Gets whether Service Workers support file access.

abstract Unit

Overrides the way the cache is used, see WebSettings#setCacheMode.

abstract Int

Gets the current setting for overriding the cache mode.

abstract Unit

Enables or disables file access within Service Workers, see WebSettings#setAllowFileAccess.

Public methods

getAllowContentAccess

abstract fun getAllowContentAccess(): Boolean

Gets whether Service Workers support content URL access.

setBlockNetworkLoads

abstract fun setBlockNetworkLoads(flag: Boolean): Unit

Sets whether Service Workers should not load resources from the network, see WebSettings#setBlockNetworkLoads.

Parameters
flag Boolean: true means block network loads by the Service Workers

getBlockNetworkLoads

abstract fun getBlockNetworkLoads(): Boolean

Gets whether Service Workers are prohibited from loading any resources from the network.

Return
Boolean: true if the Service Workers are not allowed to load any resources from the network

setAllowContentAccess

abstract fun setAllowContentAccess(allow: Boolean): Unit

Enables or disables content URL access from Service Workers, see WebSettings#setAllowContentAccess.

getAllowFileAccess

abstract fun getAllowFileAccess(): Boolean

Gets whether Service Workers support file access.

setCacheMode

abstract fun setCacheMode(mode: Int): Unit

Overrides the way the cache is used, see WebSettings#setCacheMode.

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.

getCacheMode

abstract fun getCacheMode(): Int

Gets the current setting for overriding the cache mode.

Return
Int: the current setting for overriding the cache mode

See Also

setAllowFileAccess

abstract fun setAllowFileAccess(allow: Boolean): Unit

Enables or disables file access within Service Workers, see WebSettings#setAllowFileAccess.