I need to perform some logging within my embedded WebView javascript, and ideally I could call Log.d in the encasing Activity. If that’s not possible, what’s the next/best alternative?
I need to perform some logging within my embedded WebView javascript, and ideally I
Share
Your WebView can intercept a prompt js message threw by your javascript.
You just had to create a message like “LOG.Your log message” and when your application receive it, parse this message to understant that your javascript want to Log something and that the Log value is “Your log message”.
This is how PhoneGap works.
In your javascript:
prompt('LOG.Your log message');In your java code: set a new
WebChromeClientto yourWebViewwhere your override theonJsPromptmethodmethod description here: link