is there a way to call native java code from a webview in Android other than using addJavascriptInterface?

Issue

There is a bug with the Gingerbread distribution and the addJavascriptInterface method described here: http://code.google.com/p/android/issues/detail?id12987

Although there are some workarounds for the issue like this:

http://www.jasonshah.com/handling-android-2-3-webviews-broken-addjavascriptinterface/

or this: http://twigstechtips.blogspot.com/2013/09/android-webviewaddjavascriptinterface.html

All of them are partial-fixes with some holes in them.

So I wonder if there is another way to avoid the addJavascriptInterface method to invoke native code from the html inside the webview.

Thanks in advance!

Solution

I hope and I trust there is no way to call native code expect addJavascriptInterface(), because that will be big security-exploit in Android. Nobody should be able to call native code from browser – that could cause many different abuses.

Answered By – TN888

Leave a Comment