28

Is it possible to interact with a webview in android trough my native android code?

I develop can bus driver for android and I like to send my can bus data to a html 5 app in a webview without sending them over internet to a webservice. or is it possible to call funktions via the html 5 app in my native android app?

Do you know a good solution for that scenario?

Jonas
  • 121,568
  • 97
  • 310
  • 388
znarf
  • 814
  • 2
  • 15
  • 31

2 Answers2

20

Check out addJavascriptInterface.

Felix
  • 88,392
  • 43
  • 149
  • 167
15

Here is a good example how to call javascript running inside the WebView:

http://android-er.blogspot.com/2011/10/call-javascript-inside-webview-from.html

Daniel Kurka
  • 7,973
  • 2
  • 24
  • 43