Have you take a look at how linkedin implemented the native to webview bridge ? http://engineering.linkedin.com/mobile/linkedin-ipad-nativeweb-messaging-bridge-and-websockets
They use a websocket which is must faster. This wont work on all androids but could improve performance on new devices Julien 2012/5/11 Bryce Curtis <[email protected]> > I believe XHR is faster response on average and lower overhead than > polling. I would expect addJavascriptInterface to be faster than > prompt. If someone wants to write a test case for each, then we can > try it ourselves and provide results to a wiki page to quantify it > once and for all (or until the next Android version). > > My bet is that the optimal case would be to use loadUrl("javascript:") > for Java->JS and addJavascriptInterface for JS->Java. Of course the > problem with loadUrl("javascript:") is that it steals focus - though I > remember reading somewhere that someone implied they found a solution > - don't know what it was. > > On Tue, May 8, 2012 at 4:00 PM, Anis KADRI <[email protected]> wrote: > > I do however it's not exactly formalized. I just played around with it > when > > I was working on the couchdb plugin for android and did some testing. I > can > > put something together though. I think the main issue is not if it is > > faster or not but rather if it breaks on devices (other than the 2.3 > > emulator) which I seriously doubt. > > > > On Tue, May 8, 2012 at 1:34 PM, Joe Bowser <[email protected]> wrote: > > > >> Do you have proof that addJavascriptInterface is faster despite the fact > >> that we're not using WebView.loadUrl? I seriously think we're missing a > >> large part of the picture if we don't account for that. > >> > >> On Tue, May 8, 2012 at 1:30 PM, Anis KADRI <[email protected]> > wrote: > >> > >> > > > >> > > I wonder how other frameworks get > >> > > around this issue? > >> > > >> > > >> > They don't as it's a 2.3 emulator only issue. > >> > > >> > +1 for adding addJavascriptInterface back it's just 10x faster for > >> > everything other than simple operations (like taking a picture). > >> > > >> > > >> > > > >> > > On Monday, May 7, 2012, Filip Maj wrote: > >> > > > >> > > > Something to chalk up on the todo list: test all of the Adobe VAN > + > >> SF > >> > > > office Androids with that app you put out. > >> > > > > >> > > > >We can bring addJavascriptInterface > >> > > > >back, but I don't think it's going to magically make things > better. > >> > > > > >> > > > Maybe we could do a benchmark between XHR, prompt and > addJSInterace > >> and > >> > > > see which one has best performance. And this might sound crazy but > >> > maybe > >> > > > even open our methodology and numbers up ;) > >> > > > > >> > > > > >> > > > >> > > -- > >> > > Simon Mac Donald > >> > > http://hi.im/simonmacdonald > >> > > > >> > > >> >
