Anyone can recommend best practices on doing `java...
# android
s
Anyone can recommend best practices on doing
javascriptInterface
with webview on kotlin?
g
it’s not different from doing the same on Java. Do you have some particular problem with doing this on Kotlin?
s
@gildor yea, the thing is I'm not really a native dev. So I have a react-native project and I want to move away from it, cause of its breaking changes, same reason airbnb did it. So I've resulted using WebView to salvage my js code until I learn more native development then replace my js code to native's equivalent.
g
Official guide is fine, explains how to do that and also has Kotlin snippets: https://developer.android.com/guide/webapps/webview
s
yea thanks! I was able to call an android toast via js in the webview. Now I got to figure out the camera 🙂
g
oh, it would be not so easy. I recommend to write all code on native side and have as simple as possible interface for JS
s
yea, I'm writing the camera function in kotlin and just call that from the webview via interface.