PushPlugin is not working after upgrading to cordova 3.1.0

前端 未结 1 1722
春和景丽
春和景丽 2021-02-11 09:29

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 b

1条回答
  •  無奈伤痛
    2021-02-11 09:44

    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.

    0 讨论(0)
提交回复
热议问题