Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

An alternative to Android's webview

Does anyone knows an alternative to Android's webview component ? For some reasons, it's functionality's are insufficient for me : I need to be able to catch every single request to some url, when i'm browsing a wml page (wap). Anyway, I need to be able to do stuff that Android's webview is not made for. I thought "hey, let's play with the source code, I'm pretty sure that webviews are using apache.org librairies to access internet". Oh boy was I mistaken. Webviews use native code, and that's where I'm stuck.

So I was wondering if anyone knew of another web browser view, in pure java, that would be open source and nice. It's not a problem if it's slow, i'm displaying some basic wap pages...

Thanks in advance.

like image 621
Redwarp Avatar asked Sep 30 '11 14:09

Redwarp


People also ask

What can I use instead of WebView?

Alternatives to WebView If you want to send users to a mobile site, build a progressive web app (PWA). If you want to display third-party web content, send an intent to installed web browsers. If you want to avoid leaving your app to open the browser, or if you want to customize the browser's UI, use Custom Tabs.

Is Android System WebView necessary?

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.

Is Android WebView deprecated?

The Android system webview custom cache file has been deprecated and removed in Android 13. New apps and any app updates will now use the operating system default cache location.

Is Android WebView same as Chrome?

No, Chrome for Android is separate from WebView. They're both based on the same code, including a common JavaScript engine and rendering engine.


2 Answers

You can extend WebView's functionality by using setWebViewClient & setWebChromeClient.

WebView.setWebViewClient(new MyWebViewClient()); WebView.setWebChromeClient(new WebChromeClient() {..} 

You can handle each and every request sent/received from the WebView by overriding the below methods:

public boolean shouldOverrideUrlLoading(WebView view, String url) {..} public void onPageStarted(WebView view, String url, Bitmap favicon) {..} public void onPageFinished(WebView view, String url) {..} 
like image 183
Shahul3D Avatar answered Sep 23 '22 00:09

Shahul3D


The crosswalk project: https://crosswalk-project.org/ might be what you need. But beware, there are places where it differs from the stock webview. In some ways better, in some ways worse. For example, it supports WebGL (good), but currently the background cannot be transparent (bad). The really good news, it seems to be very actively supported, running it's own Jira to track and fix and Intel seems to be very involved.

like image 27
kelvin Avatar answered Sep 24 '22 00:09

kelvin