What Is Android System WebView and Should You Uninstall It?

0
13

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.

When Android System WebView is used to embed a login function, users are taken to a web login screen encased in the app. Exiting the login page brings them back to the app.

The following are examples of how WebView is used to embed webpages:

  • When users click on a privacy policy link on a screen in an Android System WebView app, the application opens a webpage with the privacy policy content instead of taking them to a browser.
  • 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.

hybrid vs. native applications
WebView is useful for crafting hybrid applications with highly reusable code and less code than native apps.

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:

  1. Go to Settings > Apps/application > More > Show system.
  2. Scroll to and select Android WebView.
  3. 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.

JournalDev — now part of DigitalOcean — provides the following example of how to insert WebView into an XML file in Android Studio using the Kotlin programming language:

<WebView android:id="@+id/webview"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

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:

webView.loadUrl("https://www.example.com");

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.

JavaScript in WebView

JavaScript in WebView is disabled by default. This means that webpages containing JavaScript references will malfunction. To enable JavaScript, a developer using the Kotlin command line would add the following code to the WebView instance:

getSettings().setJavaScriptEnabled(true);

End users may find it helpful to use JavaScript with Android WebView so certain applications work as intended. To enable JavaScript in WebView in Chrome, follow these six steps:

  1. Click the three stacked dots next to the URL bar in the browser.
  2. Select Settings from the drop-down menu.
  3. Under the Advanced header, select Site Settings.
  4. Select JavaScript.
  5. Toggle the switch to the right so JavaScript is activated.
  6. 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.

Go to Publisher: SearchSoftwareQuality
Author: