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?
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.