Skip to content

Most visited

Recently visited

navigation

ServiceWorkerWebSettings

public abstract class ServiceWorkerWebSettings
extends Object

java.lang.Object
   ↳ 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

ServiceWorkerWebSettings()

Public methods

abstract boolean getAllowContentAccess()

Gets whether Service Workers support content URL access.

abstract boolean getAllowFileAccess()

Gets whether Service Workers support file access.

abstract boolean getBlockNetworkLoads()

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

abstract int getCacheMode()

Gets the current setting for overriding the cache mode.

abstract void setAllowContentAccess(boolean allow)

Enables or disables content URL access from Service Workers, see setAllowContentAccess(boolean).

abstract void setAllowFileAccess(boolean allow)

Enables or disables file access within Service Workers, see setAllowFileAccess(boolean).

abstract void setBlockNetworkLoads(boolean flag)

Sets whether Service Workers should not load resources from the network, see setBlockNetworkLoads(boolean).

abstract void setCacheMode(int mode)

Overrides the way the cache is used, see setCacheMode(int).

Inherited methods

From class java.lang.Object

Public constructors

ServiceWorkerWebSettings

added in API level 24
ServiceWorkerWebSettings ()

Public methods

getAllowContentAccess

added in API level 24
boolean getAllowContentAccess ()

Gets whether Service Workers support content URL access.

Returns
boolean

See also:

getAllowFileAccess

added in API level 24
boolean getAllowFileAccess ()

Gets whether Service Workers support file access.

Returns
boolean

See also:

getBlockNetworkLoads

added in API level 24
boolean getBlockNetworkLoads ()

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

Returns
boolean true if the Service Workers are not allowed to load any resources from the network

See also:

getCacheMode

added in API level 24
int getCacheMode ()

Gets the current setting for overriding the cache mode.

Returns
int the current setting for overriding the cache mode

See also:

setAllowContentAccess

added in API level 24
void setAllowContentAccess (boolean allow)

Enables or disables content URL access from Service Workers, see setAllowContentAccess(boolean).

Parameters
allow boolean

setAllowFileAccess

added in API level 24
void setAllowFileAccess (boolean allow)

Enables or disables file access within Service Workers, see setAllowFileAccess(boolean).

Parameters
allow boolean

setBlockNetworkLoads

added in API level 24
void setBlockNetworkLoads (boolean flag)

Sets whether Service Workers should not load resources from the network, see setBlockNetworkLoads(boolean).

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

setCacheMode

added in API level 24
void setCacheMode (int mode)

Overrides the way the cache is used, see setCacheMode(int).

Parameters
mode int: the mode to use. One of LOAD_DEFAULT, LOAD_CACHE_ELSE_NETWORK, LOAD_NO_CACHE or LOAD_CACHE_ONLY. The default value is LOAD_DEFAULT.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)