What is Android System WebView?
Android System WebView is a system component for the Android operating system (OS) that enables Android apps to display web content directly inside an application.
There are two ways to open web content on an Android device: You can use a traditional web browser or an Android application that includes WebView in the layout.
A developer who wants to add browser functionality to an application can include the WebView library and create an instance of a WebView class. This approach essentially embeds a browser within the app to do things like render webpages and execute script.
In the past, WebView was tightly coupled with the OS, and it was only updated when a new version of the OS was released. It is now a discrete application that can be updated through the Google Play app store.
Why is Android System WebView needed?
Android System WebView lets applications display browser windows in an app instead of transporting the user to another browser. Android developers use WebView when they want to display webpages in a Google app or other application.
The following are examples of how WebView is used to embed webpages:
- Users use a social media account to log in to an application. Developers use WebView to embed a social media application's login window inside their application and give users a choice as to how to log in. Instead of coding a sign-in function from scratch, WebView lets them import the social sign-in function.
- WebView is used to embed applications in other web application Using WebView is a low-code way of constructing hybrid applications that free developers from having to code native applications from scratch.
Malicious actors can use WebView to exploit devices, using tactics like cross-site scripting.
History of Android System WebView
Early versions of WebView were integrated as part of the core OS. Users could only update WebView through larger system updates.
With the release of Android 5.0, Google separated WebView from the core OS. With this change, WebView updates could be distributed through the Google Play Store app, and users could update WebView independently of the OS. If an issue was found in the WebView component, Google would push out a bug fix that users could install without having to completely update Android.
Google combined WebView with Google Chrome for versions 7.0, 8.0 and 9.0. However, with Android 10.0, it went back to having it as a separate component. Users can update WebView in Android 10 through Google Play Store. Sometimes, this requires they delete stored data from the application's cache before downloading the update.
Google no longer provides patches for vulnerabilities found in older versions -- 4.3 and earlier -- of Android. To protect devices from attacks that might exploit WebView's capabilities, the company recommends Android users run the latest version of the OS and update WebView when prompted.
Is it safe to uninstall Android System WebView?
WebView is impossible to uninstall because it is system software and comes pre-installed on Android devices. However, it can be disabled on certain Android versions.
Users may disable WebView for the following reasons:
- They're unfamiliar with the Android System WebView application and mistake it for malicious spyware or useless bloatware.
- It consumes more resources than they like.
- They have a bad user experience as happens occasionally because WebView is poorly integrated in a web application.
- WebView doesn't work consistently on different versions of Android.
Google does not advise disabling WebView; users should keep it activated and updated. However, users running Android 7.0, 8.0 and 9.0 may want to disable it to conserve processing power or memory or avoid crashes related to update bugs. Users can safely disable Android System WebView in the following Android versions without experiencing adverse consequences:
- Android 7.0 Nougat
- Android 8.0 Oreo
- Android 9.0 Pie
Follow these steps to disable WebView in the three versions listed above:
- Go to Settings > Apps/application > More > Show system.
- Scroll to and select Android WebView.
- Tap Disable.
On Android 7.0, 8.0 and 9.0, Google Chrome handles the embedded browsing functions. On other Android OS versions, web app performance may suffer without WebView enabled. Operating without WebView also may introduce a security risk because it disables Android's default security configuration for embedding web content in applications. Developers can use third-party code instead of WebView or alternative Android browsers to perform the same task, although third-party code may have more built-in vulnerabilities.
How to add WebView to an app
To add WebView to an app, a developer first adds a WebView component to their Extensible Markup Language (XML) file and then gives it an ID and calls the loadUrl() function on it.
To give it an ID, a developer would write the following or something similar:
WebView = (webView) findViewById(R.id.webview);
And, finally, to pass the URL of a webpage as an argument in the application, the developer would write the following:
The method used to add WebView may differ slightly depending on the language used to write the application. WebView can be embedded in both Android applications and iOS applications on iPhones and iPads.
- Click the three stacked dots next to the URL bar in the browser.
- Select Settings from the drop-down menu.
- Under the Advanced header, select Site Settings.
- Refresh the browser.
In some cases, WebView can save developers time and energy by embedding already existing code into an application. Learn how low-code development works and how it can benefit the enterprise.