当前位置: 首页 > 工具软件 > webkit.js > 使用案例 >

android 监听 webkit,androidx.webkit

宋俊艾
2023-12-01

androidx.webkit

Requirements

The minimum sdk version to use this library is 14.

How to declare the dependencies to use the library

Inside your app's build.gradle file, include this line in dependencies:dependencies {

...

implementation 'androidx.webkit:webkit:1.2.0'

}

Migrating to androidx.webkit

For static methods:

Old code:if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {

WebView.startSafeBrowsing(appContext, callback);

}

New code:if (WebViewFeature.isFeatureSupported(WebViewFeature.START_SAFE_BROWSING)) {

WebViewCompat.startSafeBrowsing(appContext, callback);

}

Or, if you are using a non-static method:

Old code:if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {

myWebView.postVisualStateCallback(requestId, callback);

}

New code:if (WebViewFeature.isFeatureSupported(WebViewFeature.VISUAL_STATE_CALLBACK)) {

WebViewCompat.postVisualStateCallback(myWebView, requestId, callback);

}

Interfaces

Classes

This class represents the JavaScript object injected by

ProxyConfig builder.

Class that holds a scheme filter and a proxy URL.

Manages setting and clearing a process-specific override for the Android system-wide proxy

settings that govern network requests made by

Base class for clients to capture Service Worker related callbacks,

see

Manages Service Workers used by WebView.

Manages settings state for all Service Workers.

Holds tracing configuration information and predefined settings

for

Manages tracing of WebViews.

The Java representation of the HTML5 PostMessage event.

The listener for handling MessagePort events.

Helper class to load local files including application's static assets and resources using

http(s):// URLs inside a

Handler class to open a file from assets directory in the application APK.

Handler class to open files from application internal storage.

Handler class to open a file from resources directory in the application APK.

Compatibility version of

Utility class for checking which WebView Support Library features are supported on the device.

WebViewRenderProcess provides an opaque handle to a WebView renderer.

Used to receive callbacks on

 类似资料: