Cordova升级到3.1.0后,无法调用onNotificationGCM函数event = register。所以我可以收到已注册手机的推送通知,但无法注册新手机。
检查 ATD 的控制台,我得到了这个:
W/PluginManager(31200): THREAD WARNING: exec() call to PushPlugin.
register blocked the main thread for 30ms. Plugin should use
CordovaInterface.getThreadPool().
谁有同样的问题,可以就此提出一些建议吗?
最佳答案
以某种方式发现 gWebView.sendJavascript(_d);未在 PushPlugin.java 中的 sendJavascript 函数中运行。可能是 PushPlugin 错误或 Cordova 错误。
/*
* Sends a json object to the client as parameter to a method which is defined in gECB.
*/
public static void sendJavascript(JSONObject _json) {
String _d = "javascript:" + gECB + "(" + _json.toString() + ")";
Log.v(TAG, "sendJavascript: " + _d);
if (gECB != null && gWebView != null) {
gWebView.sendJavascript(_d);
}
}
将 gWebView.sendJavascript(_d);
(第 105 行)更改为 gWebView.loadUrl(_d) 将解决问题。
关于java - 升级到 cordova 3.1.0 后 PushPlugin 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19801101/