Android Javascript Interface parameters

367 views
Skip to first unread message

Andrew Timberlake

unread,
Feb 19, 2015, 3:29:16 AM2/19/15
to rubym...@googlegroups.com
No parameters are coming through to methods on the Javascript Interface when using a WebView

class TestJavascriptInterface
  __annotation__('@android.webkit.JavascriptInterface')
  def myMethod(arg)
    puts
"arg: #{arg.inspect}"  # shows arg: nil when called from inside the webview
 
end
end

This article http://stackoverflow.com/questions/9749900/webview-addjavascriptinterface-function-with-parameters says that parameters should be marked as String arguments for this to work.

Is it possible to mark the argument type in RubyMotion?

Any other ways to get parameter passing to work? (I've also tried coercing the argument to a string as: myMethod(""+val))

Thanks

Andrew
Reply all
Reply to author
Forward
0 new messages