Example for WebView message handling on form completion on android

" When the form is completed, Feathery will send completion messages through Webkit and WebView message handlers that you can listen to. The message is Form completed , and the Webkit message handler name is feathery ."

Can you help me understand how this would work for android kotlin webview? (Currently we are using a javascript interface)

Hi jen, thanks for flagging! We’ve just added support for native android webviews as well https://docs.feathery.io/develop/react/api-guide/form/event-handlers/onformcomplete#android-webview

If you have your form embedded, please upgrade to version 2.0.114 or above

Thanks for the quick reply! I’m not seeing a message come through the javascript bridge and am wondering what I’m missing? This is what I’ve got:

Javascript interface:

inner class JSBridge(){
fun onComplete(message:String){
Log.d(“Feathery”, “message: $message”)

And I’ve named it FeatheryInterface:


And I’m using the url method:

webView.loadUrl(“Feathery Forms”)

I am seeing this error message after clicking on the final form button which should trigger the onComplete (not sure if it’s related):

[INFO:CONSOLE(2)] “Uncaught (in promise) Error: Method not found”, source: Feathery Forms

Hey Jen, we just added some logging to test and draft preview forms that will log mobile completion behavior. Would you mind testing again with your test or draft preview form and post the resulting completion logs here? Also the onComplete function shouldn’t take in a parameter

Ah, it was because I was expecting a parameter in the onComplete method - I see the onComplete now, along with these logs:

onConsoleMessage: Android Webview event sent
[INFO:CONSOLE(2)] “Android Webview event sent”, source: https://bigcartel.feathery.io/static/js/2.da45068e.chunk.js (2)

Thanks so much for helping me track this down!

Great! Glad this was resolved