How to implement a WebView?

This is a part of AOSP that appears to be entirely undocumented, and after days of scouring the internet for even the tiniest shred of detail, I'm at my wit's end. If this sub is inappropriate for this kind of question or if there's a better place to ask it, please let me know and I'll delete/move this post.

I'm interested in how exactly an instance of WebView is provisioned to a piece of code that requests it. Seeing how there can be more than one WebView implementation installed on a system at any given time (or none even), I'm especially interested what the requirements are for android to recognize an apk as being one.

The entirety of the Android SDK contains no interface describing the capabilities of a WebView, only the actual class itself, inheriting from which would be extremely messy. So I'm confused how (without providing a common interface) android accepts a Java class as a webview. Please don't tell me it does so by using reflection...

So if, theoretically, I'd like to code my own implementation of WebView, how would I need to go about it? What interface do I implement? What else need I do for android to recognize it as a WebView? I'll be grateful for any bit of info pointing me in the right direction.

Posted Oct 1, 2019, 7:59 AM UTC

114
citewiki•

I'll be grateful for any bit of info pointing me in the right direction.

https://chromium.googlesource.com/chromium/src/+/master/docs/android_build_instructions.md

1
theopensourceguyOP•

Definitely a better starting point than anything I found, thank you.

1
Digitakmarketing•

Implement a Web view this link will help you a lot. There is a clear coding that will help you to implement clearly https://developer.android.com/guide/webapps/webview

0
theopensourceguyOP•

Nope. I'm not looking to create an app that uses a webview, I want to implement the actual webview itself and install it as an alternative to the default chrome/chromium webview implementation.

1