Added in API level 24

ServiceWorkerWebSettings


abstract class ServiceWorkerWebSettings
kotlin.Any
   ↳ android.webkit.ServiceWorkerWebSettings

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 constructors

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

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

abstract Unit

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

abstract Unit

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

abstract Unit

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

Public constructors

ServiceWorkerWebSettings

ServiceWorkerWebSettings()

Public methods

getAllowContentAccess

Added in API level 24
abstract fun getAllowContentAccess(): Boolean

Gets whether Service Workers support content URL access.

getAllowFileAccess

Added in API level 24
abstract fun getAllowFileAccess(): Boolean

Gets whether Service Workers support file access.

getBlockNetworkLoads

Added in API level 24
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

getCacheMode

Added in API level 24
abstract fun getCacheMode(): Int

Gets the current setting for overriding the cache mode.

Return
Int the current setting for overriding the cache mode Value is android.webkit.WebSettings#LOAD_DEFAULT, android.webkit.WebSettings#LOAD_NORMAL, android.webkit.WebSettings#LOAD_CACHE_ELSE_NETWORK, android.webkit.WebSettings#LOAD_NO_CACHE, or android.webkit.WebSettings#LOAD_CACHE_ONLY

See Also

setAllowContentAccess

Added in API level 24
abstract fun setAllowContentAccess(allow: Boolean): Unit

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

setAllowFileAccess

Added in API level 24
abstract fun setAllowFileAccess(allow: Boolean): Unit

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

setBlockNetworkLoads

Added in API level 24
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