


For this, the WebViewFeature class also contains an isFeatureSupported() function, which can be used to check if a given feature is supported.

However, before we try and access this feature in any way we need to be sure that it is supported in the current situation that the webview is being used in. Within this webkit is a class called WebViewFeature – this is a collection of available features that can be accessed, and within this collection of features is FORCE_DARK. Within this version of webkit there are a few additions that make the interactions with dark mode settings a small amount of effort. The current stable release of androidx.webkit is version 1.1.0 however, dark mode support has been added in the latest alpha release, 1.2.0-alpha01. To get started with androidx.webkit we need to begin by adding the dependency to our application: implementation "androidx.webkit:webkit:1.2.0-alpha01" But there is good news! The androidx.webkit package has recently worked on adding support for dark theming within WebViews – allowing us to provide a consistent dark theme experience throughout our application.
