-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
addJavascriptInterface not working #15
Comments
Current project was designed to work with Phonegap-0.9 version. Probably you are using some other version, and that's why you are seeing this problem. I didn't get a chance to update this project for newer Phonegap versions. Will do it whenever I have some time.
|
Hi, Maybe you have already figured it out how to solve (or work around) this issue, but this comment can help others who might get into the same issue. This issue happens if your target API is Jelly Beans MR1 or higher. If this is the case, the WebSocketFactory class should be updated to follow the new guidelines of the Android API about the usage of the |
This issue happens if your target API is Jelly Beans MR1 or higher. If this is the case, the WebSocketFactory class should be updated to follow the new guidelines of the Android API about the usage of the addJavascriptInterface() method. if i want to work with api 17. then in that case what should i have to do? how will i update WebSocketFactory class . Or may be some other trick or idea? |
I didn't try it myself, as I don't need to work with the newest APIs, but maybe you might find some guidelines in the Android API at: http://developer.android.com/reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object,%20java.lang.String) |
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!
The text was updated successfully, but these errors were encountered: