升级到cordova 3.1.0后,PushPlugin无法正常工作(PushPlugin is not working after upgrading to cordova 3.1.0)

编程入门 行业动态 更新时间:2024-10-21 20:37:15
升级到cordova 3.1.0后,PushPlugin无法正常工作(PushPlugin is not working after upgrading to cordova 3.1.0)

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

更多推荐

本文发布于:2023-08-07 21:03:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465583.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:升级到   无法正常   工作   cordova   PushPlugin

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!