Skip to content

addJavascriptInterface not working #15

Open
@xli2012

Description

@xli2012

Hi,

I followed your instruction and built the sample phonegap app, but it doesn't work plus the log shows:
E/Web Console( 1285): Uncaught TypeError: Object [object Object] has no method 'getInstance' at file:///android_asset/www/js/websocket.js:35

The main class looks like this:
public class Grunt extends DroidGap
{
@OverRide
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
init();
final WebSocketFactory factory = new WebSocketFactory(appView);
appView.addJavascriptInterface(factory, "WebSocketFactory");
loadUrl("file:///android_asset/www/websocket.html");
}
}
I have tried to swap the lines, calling init(), etc., none works.
Do you have a thought? I have googled the whole night and couldn't find a solution, please give me some light!

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions