videostream / cordova-chromecast

Chromecast running in Cordova
117 stars 58 forks source link

Deprecated "sendJavascript" in CordovaWebView #30

Open Vaporexpress opened 9 years ago

Vaporexpress commented 9 years ago

First of all, thanks for your great work. FYI, in your plugin code you use "sendJavascript" which is deprecated in CordovaWebView.java where i can see: /* * Send JavaScript statement back to JavaScript. * Deprecated (https://issues.apache.org/jira/browse/CB-6851) * Instead of executing snippets of JS, you should use the exec bridge * to create a Java->JS communication channel. * To do this: * 1. Within plugin.xml (to have your JS run before deviceready): * * 2. Within your .js (call exec on start-up): * require('cordova/channel').onCordovaReady.subscribe(function() { * require('cordova/exec')(win, null, 'Plugin', 'method', []); * function win(message) { * ... process message from java here ... * } * }); * 3. Within your .java: * PluginResult dataResult = new PluginResult(PluginResult.Status.OK, CODE); * dataResult.setKeepCallback(true); * savedCallbackContext.sendPluginResult(dataResult); / Maybe this is the cause that sometimes the follow warning is raised by function "emitAllRoutes": "W/PluginManager﹕ THREAD WARNING: exec() call to Chromecast.emitAllRoutes blocked the main thread for 21ms. Plugin should use CordovaInterface.getThreadPool().".

http://www.donmarges.io/thread-warning-exec-call-blocked-the-main-thread-plugin-should-use-cordovainterface-getthreadpool-cordova-plugin-warning/

PD: Sorry my bad english.

kibotu commented 8 years ago

have a look at #59