Hi,

We think the root cause is found. It's because callers have to use the 
annotation "org.chromium.content.browser.JavascriptInterface" instead of 
"android.webkit.JavascriptInterface".

We've verified it can work locally.



To minify the changes, callers could replace "import 
android.webkit.JavascriptInterface;" with "import 
org.chromium.content.browser.JavascriptInterface;" in their source code.

Will you mind trying it again? Thanks.



Yongsheng



> -----Original Message-----

> From: GIBERT Xavier [mailto:[email protected]]

> Sent: Friday, April 25, 2014 3:23 PM

> To: Zhu, Yongsheng

> Cc: Alexis Menard; [email protected]

> Subject: RE: [Crosswalk-dev] Java-Javascript interface

>

> If I use the addJavascriptInterface like I was doing with the original 
> WebView, the

> index.html crashes when trying to call one of these

> functions:

>

> Uncaught TypeError: Object [object Object] has no method 'setProgress'

>

> I guess evaluateJavascript is for the Java->Javascript sens like when calling 
> a

> javascript method from loadURL()?

>

> I am passing a big object from Java to Javascript but asked by the second one.

>

> Thank you.

>

> Xavier

>

> Quoting "Zhu, Yongsheng" 
> <[email protected]<mailto:[email protected]>>:

>

> > Currently extension is not for xwalk core library.

> > We support addJavascriptInterface and evaluateJavascript in core

> > library. It would be great if you can share what errors you met.

> > Thanks.

> >

> > Yongsheng

> >

> >> -----Original Message-----

> >> From: Crosswalk-dev

> >> [mailto:[email protected]]

> >> On Behalf Of GIBERT Xavier

> >> Sent: Thursday, April 24, 2014 10:44 PM

> >> To: Alexis Menard

> >> Cc: 
> >> [email protected]<mailto:[email protected]>

> >> Subject: Re: [Crosswalk-dev] Java-Javascript interface

> >>

> >> Quoting Alexis Menard <[email protected]<mailto:[email protected]>>:

> >>

> >> > Hi,

> >> >

> >> > On Thu, Apr 24, 2014 at 11:30 AM, GIBERT Xavier

> >> <[email protected]<mailto:[email protected]>> wrote:

> >> >> Hello, I successfully integrated the xwalk_core_library project

> >> >> with my Android app, replacing the original webview by the XWalkView.

> >> >>

> >> >> It works perfectly until I call one of the old JavascriptInterface

> >> >> methods that I used with the webview.

> >> >>

> >> >

> >> > Thanks for trying Crosswalk.

> >> >

> >> >> From what I know, the JavascriptInterface cannot be used with the

> >> XWalkView.

> >> >> I was wondering what is then the best option to implement a

> >> >> Java-Javascript interface for XWalkView. An internal Extension? I

> >> >> have only found a tutorial to create an external extension, not

> >> >> internal; what is very complicated because at almost each command

> >> >> of the crosswalk building tutorials I get errors; and I think I

> >> >> will not be able to access the application variables, that is what

> >> >> I want

> >> to share.

> >> >

> >> > https://crosswalk-project.org/#wiki/Writing-a-Crosswalk-Java-Extens

> >> > ion

> >> > -on-Android

> >> >

> >> > Is it what you have been following?

> >>

> >> Yes, I red it in Github but I've seen that is exactly the same. I

> >> haven't tried it yet because I am afraid it is not what I am looking

> >> for. With an external API I guess I won't be able to access my

> >> application variables, just Android device functions.

> >> Maybe I am wrong. And I definelly don't want to implement a network

> >> connection between the two sides, e.g sockets).

> >>

> >> Thanks for your time.

> >>

> >>

> >> >

> >> >>

> >> >> Can you help me with some indications about how to implement this

> >> >> sharing of variables (methods returning the variables) between

> >> >> Android application and XWalkView javascript code. What I want to

> >> >> share is mainly the Android Preferences.

> >> >>

> >> >> Thanks a lot, regards.

> >> >>

> >> >> Xavi

> >> >>

> >> >> ----------------------------------------------------------------

> >> >> This message was sent using IMP, the Internet Messaging Program.

> >> >>

> >> >>

> >> >> _______________________________________________

> >> >> Crosswalk-dev mailing list

> >> >> [email protected]<mailto:[email protected]>

> >> >> https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-dev

> >> >

> >> >

> >> >

> >> > --

> >> > Alexis Menard

> >> >

> >> >

> >>

> >>

> >>

> >> ----------------------------------------------------------------

> >> This message was sent using IMP, the Internet Messaging Program.

> >>

> >>

> >> _______________________________________________

> >> Crosswalk-dev mailing list

> >> [email protected]<mailto:[email protected]>

> >> https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-dev

> >

> >

>

>

>

> ----------------------------------------------------------------

> This message was sent using IMP, the Internet Messaging Program.

>


_______________________________________________
Crosswalk-dev mailing list
[email protected]
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-dev

Reply via email to