java - 升级到 cordova 3.1.0 后 PushPlugin 不工作

标签 java javascript android cordova push-notification

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/

相关文章:

android - 库 com.google.firebase :firebase-iid is being requested by various other libraries at [[17. 0.0,17.0.0]],但解析为 16.2.0

java - 从 CSV 文件中读取 NULL 值

java - Android Studio 翻译 strings.xml 后无法解析符号 'R'

java - 为什么方法 Message.getFrom() 返回一个数组?

从字符串中拆分并返回值的 Javascript 函数

javascript - 面向对象的Javascript : Should Private Functions Be Added to Class Prototype?

javascript - 侧边菜单悬停关闭延迟问题

java - 如何从 Lat 和 Long 获取邮政编码?

java - IntelliJ IDEA 断点无效

java - 如何在java中声明和填充另一个对象 vector 内的对象 vector ?