Android JellyBean JavascriptInterface annotation

Hey guys, Android JellyBeans introduces JavascriptInterface annotation, I don't see it in Xamarin.Android. How to do the same in Xamarin.Android?:

class JsObject {
public String toString() {
return "injectedObject";

webView.addJavascriptInterface(new JsObject(), "injectedObject");
webView.loadData("", "text/html", null);

Best Answer


  • CheesebaronCheesebaron DKInsider, University mod

    Use [JavascriptInterface].

  • I need yet to import Mono.Android.Export.dll? Thanks a lot.

  • CheesebaronCheesebaron DKInsider, University mod

    I did some JavascriptInterfacing a while back, where I had to make a dummy .java file with the methods and signatures needed for the interfaces and used JNI to make a wrapper for C#. You can look in for a sample.

  • Thanks a lot, guys :D:D:D:D

Sign In or Register to comment.