1

不知何故,我不能让谷歌服务器调用我在 ecb 中定义的函数。它总是抛出这样的错误: processMessage failed: Message:"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")
        }
    }
})

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

4

0 回答 0