在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().任何人都有同样的问题,可以给出一些建议吗?
After Cordova upgrading to 3.1.0, onNotificationGCM function event = register cannot been called. So I can get push notification for the registered phone, but new phone cannot be registered.
Checking console of ATD, I got this:
W/PluginManager(31200): THREAD WARNING: exec() call to PushPlugin. register blocked the main thread for 30ms. Plugin should use CordovaInterface.getThreadPool().Anyone has same problem and could give some suggestions on this?
最满意答案
发现某种方式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)将解决问题。
Found somehow gWebView.sendJavascript(_d); is not running in sendJavascript function in PushPlugin.java. It could PushPlugin error or Cordova error.
/* * 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); } }Change gWebView.sendJavascript(_d);(line 105) to gWebView.loadUrl(_d) will fix problem.
更多推荐
发布评论