New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial Android support (issues #103 #132 #406) #426
base: master
Are you sure you want to change the base?
Conversation
good job! man. |
How much of this should go in a future Java binding? |
Hmm, looks like maybe there are stricter rules on ndk these days. I searched some other works like crosswalk and NDK webkit. They are either unmaintained or abandoned. |
Those are external libraries used at Android 4 times, ie. they compile the entire webkit and include it inside the apk, similar to electron on the desktop, and also really heavy. Most apps do not need it anymore, because the system uses Chrome from the store as backend or fallback to vendor webview, that nowadays is enough for many cases. But those are only exposed by the Java SDK, and non-exposed native libraries cannot be used at least since Android 6. I think the spirit of this library is to use webview backend included in the system (ie. store or vendor one) instead of having to bundle a custom one making the apk bigger... Even if that means using JNI. The thing I'm not so sure is if avoiding Java code is convenient or not. I tried to implement everything using C++, but Java interface implementations (eg. Runnable) cannot be done using C++ code. |
I agree that the approach of using the native webvie is best as opppsed to bundling your own. Did you have any luck with JNI ? |
@rainbyte I'm still intending on reviewing this. I just have to set aside some time to set up an Android development environment and test it on an Android device, which I don't have readily available. |
Here is an webview written in golang. https://github.com/inkeliz/gowebview Its based on https://github.com/webview/webview, but takes a different approach where it does not use CGO. It supports desktops and mobile. Mobile.
Desktop.
|
@rainbyte I have an Android development environment set up and I'm starting to test this. Sorry for the delay. |
That would be great @justjosias , I didn't look into the codebase recently, but feel free to ask anything you need |
Hello webviewers.
I have written some code to support webview on Android. It may be not so good yet, but at least compiles and supports some features (bind, dispatch, init, eval, navigate, etc).
An Android project should be used as wrapper because a bit of Java code is needed as glue (couldn't avoid it) and also to generate the apk.
The implementation needs testing and there are some parts which should be improved or replaced (eg. init has some ugly workarounds).
I hope you can leave some comments.