Phonegap iOS推送通知插件 - 图标点击时通知为空

时间:2013-03-14 10:46:12

标签: cordova callback notifications push-notification icons

我在Phonegap / Cordova 2.1上使用iOS PushNotification插件(https://github.com/phonegap/phonegap-plugins/tree/master/iOS/PushNotification)。

“推送通知”事件工作正常,相关的事件处理程序触发就好了。但是,我有一些意想不到的结果: 启动应用程序时会调用getPendingNotifications,但是......

  • 如果我点按iPhone顶部收到的通知(通知中心),一切正常。
  • 如果我点击应用程序启动图标(上面带有通知标记),我从getPendingNotifications收到的通知数组为空。

创建此问题时,我发现此帖子: PushNotification in iOs and Application icon is clicked

但我真的无法想象这应该是预期的行为。

然而,这是我的getPending方法,它在简历和在线中被调用:

getPending: function() {
    app.pushNotification = window.plugins.pushNotification;
    app.pushNotification.getPendingNotifications(function(notifications) {
        console.log('PushNotification: getPending ' + JSON.stringify([notifications]));
        if(notifications) {
            $.each(notifications, function(i, el) {
                if(el[0].page && el[0].aps.alert) {
                    app.pushContent = el[0].page;
                    navigator.notification.alert(
                        el[0].aps.alert,  // message
                        app.redirectPushcontent,         // callback
                        'Push it',            // title
                        'real good'           // buttonName
                    );
                }
            });
        }
    });
},

更新 我使用了一个名为getIconBadgeNumber的PushNotification PlugIn的新方法。 如果BadgeNumber> 0,则必须有新的通知。我无法收到PushNotification消息,但我可以做其他事情。这是某事......

0 个答案:

没有答案