PushNotification错误ecb方法未定义

时间:2015-01-14 11:09:42

标签: cordova push-notification phonegap-plugins google-cloud-messaging phonegap-pushplugin

不知怎的,我不能让Google Server调用我在ecb中定义的函数。 它总是抛出这样的错误: processMessage失败:消息:"Javascript:services.onNotificationGCM({"regid":"APA91bFYQ0BJcTcHCBGM0ipQZ0qAbsZUQK-EW0BIrF-Tl-dB_H7GAxHGhHXcxYUvrzykg9jVChZIEPRSpgtIYj02EwpwofukxdImIKFharjihIQ2tgEWOnDJrP6WX7ZJ0j1G8ldJllPMTPR155Pyx9PGT1eWm0zYzw","event":"registered"})"

我的代码

var services = angular.module('services', [])
services.factory('services', function() {
    var bgGeo;
    return {
        enablePushNotification: function() {
            document.addEventListener("deviceready", function() {
                var pushNotification = window.plugins.pushNotification
                    .register(function(result) {
                        alert(
                            'Callback Success! Result = ' +
                            result)
                    }, function(error) {
                        alert("ErrorHandler");
                        alert(error);
                    }, {
                        "senderID": "168615009802",
                        "ecb": "services.onNotificationGCM"
                    });
            }, false)
        },
        onNotificationGCM: function(e) {
            alert("onNotification extra factory")
        }
    }
})

我真的尝试了一切,所以我希望你能帮助我! 谢谢! :)

0 个答案:

没有答案