Most visited

Recently visited

Added in API level 24

ServiceWorkerClient

public class ServiceWorkerClient
extends Object

java.lang.Object
    android.webkit.ServiceWorkerClient


客户端捕获Service Worker相关回调的基类,有关使用示例,请参阅 ServiceWorkerController

摘要(Summary)

Public constructors

ServiceWorkerClient()

公共方法(Public methods)

WebResourceResponse shouldInterceptRequest(WebResourceRequest request)

通知资源请求的主机应用程序并允许应用程序返回数据。

继承方法(Inherited methods)

From class java.lang.Object

Public constructors

ServiceWorkerClient

Added in API level 24
ServiceWorkerClient ()

公共方法(Public methods)

shouldInterceptRequest

Added in API level 24
WebResourceResponse shouldInterceptRequest (WebResourceRequest request)

通知资源请求的主机应用程序并允许应用程序返回数据。 如果返回值为空,则服务工作者将像往常一样继续加载资源。 否则,将使用返回响应和数据。 注意:此方法在UI线程以外的线程上调用,因此客户端在访问私人数据或视图系统时应谨慎行事。

参数(Parameters)
request WebResourceRequest: Object containing the details of the request.
返回(Returns)
WebResourceResponse A WebResourceResponse containing the response information or null if the WebView should load the resource itself.

也可以看看:

Hooray!