取消注册推送通知phonegap推送插件

时间:2013-05-28 15:33:24

标签: push-notification cordova phonegap-plugins

推送通知取消注册时遇到问题。我能够注册设备并获取令牌,也发送通知,但我也想添加取消注册功能。这是为它写的代码:

var unsubscribeNotification = function unsubscribeNotification() {
    try  {
        pushNotification.unregister(
        function(e) {
            //unRegister Success!!!
            alert('unRegister Success');
        }, 
        function(e) {
            //unRegister Failed!!!
            alert('unRegister Failed');
        });
    }
    catch(err) {
        //Handle errors here
        alert(err.message);
    }
}

单击它时,我还会设置一个按钮来运行unsubscribeNotification()函数。几秒钟后,应用程序停止,没有错误,没有消息,什么都没有!

我正在使用Galaxy S3,我认为它有Android 4.1

感谢您的帮助!

0 个答案:

没有答案