WebViewFeature
public
class
WebViewFeature
extends Object
java.lang.Object | |
↳ | androidx.webkit.WebViewFeature |
Utility class for checking which WebView Support Library features are supported on the device.
Summary
Public methods | |
---|---|
static
boolean
|
isFeatureSupported(String feature)
Return whether a feature is supported at run-time. |
Inherited methods | |
---|---|
Constants
CREATE_WEB_MESSAGE_CHANNEL
public static final String CREATE_WEB_MESSAGE_CHANNEL
Feature for isFeatureSupported(String)
.
This feature covers
WebViewCompat.createWebMessageChannel(WebView)
.
Constant Value: "CREATE_WEB_MESSAGE_CHANNEL"
DISABLED_ACTION_MODE_MENU_ITEMS
public static final String DISABLED_ACTION_MODE_MENU_ITEMS
Feature for isFeatureSupported(String)
.
This feature covers
WebSettingsCompat.getDisabledActionModeMenuItems(WebSettings)
, and
WebSettingsCompat.setDisabledActionModeMenuItems(WebSettings, int)
.
Constant Value: "DISABLED_ACTION_MODE_MENU_ITEMS"
OFF_SCREEN_PRERASTER
public static final String OFF_SCREEN_PRERASTER
Feature for isFeatureSupported(String)
.
This feature covers
WebSettingsCompat.getOffscreenPreRaster(WebSettings)
, and
WebSettingsCompat.setOffscreenPreRaster(WebSettings, boolean)
.
Constant Value: "OFF_SCREEN_PRERASTER"
POST_WEB_MESSAGE
public static final String POST_WEB_MESSAGE
Feature for isFeatureSupported(String)
.
This feature covers
WebViewCompat.postWebMessage(WebView, WebMessageCompat, Uri)
.
Constant Value: "POST_WEB_MESSAGE"
RECEIVE_HTTP_ERROR
public static final String RECEIVE_HTTP_ERROR
Feature for isFeatureSupported(String)
.
This feature covers
WebViewClientCompat.onReceivedHttpError(android.webkit.WebView, WebResourceRequest, WebResourceResponse)
.
Constant Value: "RECEIVE_HTTP_ERROR"
RECEIVE_WEB_RESOURCE_ERROR
public static final String RECEIVE_WEB_RESOURCE_ERROR
Feature for isFeatureSupported(String)
.
This feature covers
WebViewClientCompat.onReceivedError(android.webkit.WebView, WebResourceRequest, WebResourceErrorCompat)
.
Constant Value: "RECEIVE_WEB_RESOURCE_ERROR"
SAFE_BROWSING_ENABLE
public static final String SAFE_BROWSING_ENABLE
Feature for isFeatureSupported(String)
.
This feature covers
WebSettingsCompat.getSafeBrowsingEnabled(WebSettings)
, and
WebSettingsCompat.setSafeBrowsingEnabled(WebSettings, boolean)
.
Constant Value: "SAFE_BROWSING_ENABLE"
SAFE_BROWSING_HIT
public static final String SAFE_BROWSING_HIT
Feature for isFeatureSupported(String)
.
This feature covers
WebViewClientCompat.onSafeBrowsingHit(android.webkit.WebView, WebResourceRequest, int, SafeBrowsingResponseCompat)
.
Constant Value: "SAFE_BROWSING_HIT"
SAFE_BROWSING_PRIVACY_POLICY_URL
public static final String SAFE_BROWSING_PRIVACY_POLICY_URL
Feature for isFeatureSupported(String)
.
This feature covers
WebViewCompat.getSafeBrowsingPrivacyPolicyUrl()
.
Constant Value: "SAFE_BROWSING_PRIVACY_POLICY_URL"
SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY
public static final String SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY
Feature for isFeatureSupported(String)
.
This feature covers
SafeBrowsingResponseCompat.backToSafety(boolean)
.
Constant Value: "SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY"
SAFE_BROWSING_RESPONSE_PROCEED
public static final String SAFE_BROWSING_RESPONSE_PROCEED
Feature for isFeatureSupported(String)
.
This feature covers
SafeBrowsingResponseCompat.proceed(boolean)
.
Constant Value: "SAFE_BROWSING_RESPONSE_PROCEED"
SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL
public static final String SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL
Feature for isFeatureSupported(String)
.
This feature covers
SafeBrowsingResponseCompat.showInterstitial(boolean)
.
Constant Value: "SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL"
SAFE_BROWSING_WHITELIST
public static final String SAFE_BROWSING_WHITELIST
Feature for isFeatureSupported(String)
.
This feature covers
WebViewCompat.setSafeBrowsingWhitelist(List, ValueCallback)
.
Constant Value: "SAFE_BROWSING_WHITELIST"
SERVICE_WORKER_BASIC_USAGE
public static final String SERVICE_WORKER_BASIC_USAGE
Feature for isFeatureSupported(String)
.
This feature covers
ServiceWorkerControllerCompat.getInstance()
.
Constant Value: "SERVICE_WORKER_BASIC_USAGE"
SERVICE_WORKER_BLOCK_NETWORK_LOADS
public static final String SERVICE_WORKER_BLOCK_NETWORK_LOADS
Feature for isFeatureSupported(String)
.
This feature covers
ServiceWorkerWebSettingsCompat.getBlockNetworkLoads()
, and
ServiceWorkerWebSettingsCompat.setBlockNetworkLoads(boolean)
.
Constant Value: "SERVICE_WORKER_BLOCK_NETWORK_LOADS"
SERVICE_WORKER_CACHE_MODE
public static final String SERVICE_WORKER_CACHE_MODE
Feature for isFeatureSupported(String)
.
This feature covers
ServiceWorkerWebSettingsCompat.getCacheMode()
, and
ServiceWorkerWebSettingsCompat.setCacheMode(int)
.
Constant Value: "SERVICE_WORKER_CACHE_MODE"
SERVICE_WORKER_CONTENT_ACCESS
public static final String SERVICE_WORKER_CONTENT_ACCESS
Feature for isFeatureSupported(String)
.
This feature covers
ServiceWorkerWebSettingsCompat.getAllowContentAccess()
, and
ServiceWorkerWebSettingsCompat.setAllowContentAccess(boolean)
.
Constant Value: "SERVICE_WORKER_CONTENT_ACCESS"
SERVICE_WORKER_FILE_ACCESS
public static final String SERVICE_WORKER_FILE_ACCESS
Feature for isFeatureSupported(String)
.
This feature covers
ServiceWorkerWebSettingsCompat.getAllowFileAccess()
, and
ServiceWorkerWebSettingsCompat.setAllowFileAccess(boolean)
.
Constant Value: "SERVICE_WORKER_FILE_ACCESS"
SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST
public static final String SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST
Feature for isFeatureSupported(String)
.
This feature covers
ServiceWorkerClientCompat.shouldInterceptRequest(WebResourceRequest)
.
Constant Value: "SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST"
SHOULD_OVERRIDE_WITH_REDIRECTS
public static final String SHOULD_OVERRIDE_WITH_REDIRECTS
Feature for isFeatureSupported(String)
.
This feature covers
WebViewClientCompat.shouldOverrideUrlLoading(android.webkit.WebView, WebResourceRequest)
.
Constant Value: "SHOULD_OVERRIDE_WITH_REDIRECTS"
START_SAFE_BROWSING
public static final String START_SAFE_BROWSING
Feature for isFeatureSupported(String)
.
This feature covers
WebViewCompat.startSafeBrowsing(Context, ValueCallback)
.
Constant Value: "START_SAFE_BROWSING"
VISUAL_STATE_CALLBACK
public static final String VISUAL_STATE_CALLBACK
Feature for isFeatureSupported(String)
.
This feature covers
WebViewCompat.postVisualStateCallback(android.webkit.WebView, long, WebViewCompat.VisualStateCallback)
, and WebViewClientCompat.onPageCommitVisible(android.webkit.WebView, String)
.
Constant Value: "VISUAL_STATE_CALLBACK"
WEB_MESSAGE_CALLBACK_ON_MESSAGE
public static final String WEB_MESSAGE_CALLBACK_ON_MESSAGE
Feature for isFeatureSupported(String)
.
This feature covers
WebMessagePortCompat.WebMessageCallbackCompat.onMessage(WebMessagePortCompat, WebMessageCompat)
.
Constant Value: "WEB_MESSAGE_CALLBACK_ON_MESSAGE"
WEB_MESSAGE_PORT_CLOSE
public static final String WEB_MESSAGE_PORT_CLOSE
Feature for isFeatureSupported(String)
.
This feature covers
WebMessagePortCompat.close()
.
Constant Value: "WEB_MESSAGE_PORT_CLOSE"
WEB_MESSAGE_PORT_POST_MESSAGE
public static final String WEB_MESSAGE_PORT_POST_MESSAGE
Feature for isFeatureSupported(String)
.
This feature covers
WebMessagePortCompat.postMessage(WebMessageCompat)
.
Constant Value: "WEB_MESSAGE_PORT_POST_MESSAGE"
WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK
public static final String WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK
Feature for isFeatureSupported(String)
.
This feature covers
WebMessagePortCompat.setWebMessageCallback(WebMessagePortCompat.WebMessageCallbackCompat)
, and
WebMessagePortCompat.setWebMessageCallback(Handler, WebMessagePortCompat.WebMessageCallbackCompat)
.
Constant Value: "WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK"
WEB_RESOURCE_ERROR_GET_CODE
public static final String WEB_RESOURCE_ERROR_GET_CODE
Feature for isFeatureSupported(String)
.
This feature covers
WebResourceErrorCompat.getErrorCode()
.
Constant Value: "WEB_RESOURCE_ERROR_GET_CODE"
WEB_RESOURCE_ERROR_GET_DESCRIPTION
public static final String WEB_RESOURCE_ERROR_GET_DESCRIPTION
Feature for isFeatureSupported(String)
.
This feature covers
WebResourceErrorCompat.getDescription()
.
Constant Value: "WEB_RESOURCE_ERROR_GET_DESCRIPTION"
WEB_RESOURCE_REQUEST_IS_REDIRECT
public static final String WEB_RESOURCE_REQUEST_IS_REDIRECT
Feature for isFeatureSupported(String)
.
This feature covers
WebResourceRequestCompat.isRedirect(WebResourceRequest)
.
Constant Value: "WEB_RESOURCE_REQUEST_IS_REDIRECT"
Public methods
isFeatureSupported
public static boolean isFeatureSupported (String feature)
Return whether a feature is supported at run-time. On devices running Android version Build.VERSION_CODES.LOLLIPOP
and higher, this will check whether a feature is
supported, depending on the combination of the desired feature, the Android version of
device, and the WebView APK on the device. If running on a device with a lower API level,
this will always return false
.
Note: If this method returns false
, it is not safe to invoke
the methods requiring the desired feature. Furthermore, if this method returns false
for a particular feature, any callback guarded by that feature will not be invoked.
Parameters | |
---|---|
feature |
String : the feature to be checked |
Returns | |
---|---|
boolean |
whether the feature is supported given the current platform SDK and webview version |
Interfaces
Classes
- SafeBrowsingResponseCompat
- ServiceWorkerClientCompat
- ServiceWorkerControllerCompat
- ServiceWorkerWebSettingsCompat
- WebMessageCompat
- WebMessagePortCompat
- WebMessagePortCompat.WebMessageCallbackCompat
- WebResourceErrorCompat
- WebResourceRequestCompat
- WebSettingsCompat
- WebViewClientCompat
- WebViewCompat
- WebViewFeature